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
added oauth2 login using proxy setting #106
base: master
Are you sure you want to change the base?
Conversation
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.
Couple of minor things:
-
this PR is overriding the
type
builtin - please either rename this variable, or if it is never to be used, replace with_
-
the code can be simplified by using the default option for
os.environ.get
, e.g.:os.environ.get('http_proxy', host)
This then removes the need for the not None
if tests.
- I'm also not sure of the reason for the change of
request_path
tourl
in theconnection.request
method call?
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.
Please add a line to the change log
authomatic/providers/__init__.py
Outdated
@@ -382,14 +383,26 @@ def _fetch(self, url, method='GET', params=None, headers=None, body='', max_redi | |||
self._log(logging.DEBUG, ' \u251C\u2500 params: {0}'.format(params)) | |||
self._log(logging.DEBUG, ' \u2514\u2500 headers: {0}'.format(headers)) | |||
|
|||
http_proxy = os.environ.get('http_proxy') | |||
https_proxy= os.environ.get('https_proxy') | |||
type,https_host=https_proxy.split('//') |
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.
type
is a built_in, to avoid conflicts in names use type_
as it's done often in Python.
Also add a space after the ,
(pep8)
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.
and spaces around =
connection = http_client.HTTPConnection(http_host) | ||
connection.set_tunnel(host) | ||
else: | ||
connection = http_client.HTTPConnection(host) |
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.
DRY - this can be written simpler.
Addresses Issue #71 #105 .
Added support for Authomatic to work behind a proxy. It looks for http_proxy / https_proxy environment variables and uses them in the connection calls.