Skip to content

Conversation

@jonathanlloyd
Copy link
Contributor

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

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
@jonathanlloyd jonathanlloyd self-assigned this Nov 19, 2019
@codecov-io
Copy link

codecov-io commented Nov 19, 2019

Codecov Report

Merging #25 into master will not change coverage.
The diff coverage is 100%.

Impacted file tree graph

@@          Coverage Diff          @@
##           master    #25   +/-   ##
=====================================
  Coverage     100%   100%           
=====================================
  Files           4      4           
  Lines         479    483    +4     
=====================================
+ Hits          479    483    +4
Impacted Files Coverage Δ
pusher_push_notifications/__init__.py 100% <100%> (ø) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update dec67aa...efb7702. Read the comment docs.


def _get_proxies_from_env():
return {
'http': os.environ.get('HTTP_PROXY') or os.environ.get('http_proxy'),
Copy link
Contributor

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:
Copy link
Contributor

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?

Copy link
Contributor

@luismfonseca luismfonseca left a 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!

@jonathanlloyd jonathanlloyd merged commit afacfbe into master Nov 25, 2019
@jonathanlloyd jonathanlloyd deleted the support-proxy-env-vars branch November 25, 2019 16:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Failed to establish a new connection when deloy pythonanywhere

4 participants