-
Notifications
You must be signed in to change notification settings - Fork 8
Add support for loading proxy config from the environment #25
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
The popular python deployment platform PythonAnywhere requires that http proxy settings be loaded from the environment when using their free plan (to whitelist domains). This change adds a flag to enable loading this configuration. Fixes #24
Codecov Report
@@ Coverage Diff @@
## master #25 +/- ##
=====================================
Coverage 100% 100%
=====================================
Files 4 4
Lines 479 483 +4
=====================================
+ Hits 479 483 +4
Continue to review full report at Codecov.
|
|
|
||
| def _get_proxies_from_env(): | ||
| return { | ||
| 'http': os.environ.get('HTTP_PROXY') or os.environ.get('http_proxy'), |
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.
It's case sensitive? :o
| # They require that proxy servers be loaded from the environment when | ||
| # making requests (on their free plan). | ||
| # This flag enables this behaviour. | ||
| if self._use_proxy_env_vars: |
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.
So instead of making a new flag, can't we just have more specific env vars? If we use something like BEAMS_CLIENT_HTTP_PROXY, we don't really need to create this flag because the env var is already specific enough to only apply to this SDK.
If this is a bit awkward as these ones are already set automatically, perhaps we can consider just using them by default? Does urllib3, requests and curl packages require this second flag?
luismfonseca
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.
Looks good.
Don't forget to update the changelog!
The popular python deployment platform PythonAnywhere requires that
http proxy settings be loaded from the environment when using their free plan
(to whitelist domains). This change adds a flag to enable loading this configuration.
Fixes #24