-
-
Notifications
You must be signed in to change notification settings - Fork 89
feat: Pass custom headers to tile server requests #266
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
> contextily/tests/test_cx.py:806: RuntimeWarning: More than 20 figures have been opened. Figures created through the pyplot interface (`matplotlib.pyplot.figure`) are retained until explicitly closed and may consume too much memory. (To control this warning, see the rcParam `figure.max_open_warning`). Consider using `matplotlib.pyplot.close()`.
|
This also removes an unrelated matplotlib pytest warning ( ad65bcb ). |
d9a1ebe to
e4c2ee5
Compare
martinfleis
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks! I think this approach is fine. Just one comment - can we catch a situation when a user passes custom user-agent in headers?
|
Thanks, @martinfleis . Which behavior do you prefer?
My very mild preference is for option 3 to pass responsibility to the user, but I defer to you. I implemented option 1, because I was unsusre of the significance of the contextily |
|
I would go with the option 3. We generate it to essentially get a unique identifier of the process that is fetching the tiles. I am happy to let users override this without a warning. |
|
After review, option 3 was already implemented. Added a test to confirm the user provided user-agent overrides the contextily user-agent ( 546fdc8 ). |
martinfleis
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks!
This pull request allows contextily users to pass an optional
headersparameter that will be included in the_retryerfunction'srequest.getcall to the tile server.We use titiler with cloud optimized geotiffs for tiles and often authenticate the titiler server with an authentication bearer token in the http request headers. This change allows us to use contextily with our authenticated titiler.
Opening this pull request for discussion in case it is of use to others. Please let me know if there is a simpler way to use contextily with custom headers.
Related issue: #267