Skip to content
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

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

arathi123
Copy link

@arathi123 arathi123 commented Jun 2, 2015

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.

Copy link
Member

@mrichar1 mrichar1 left a 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 to url in the connection.request method call?

Copy link
Member

@jensens jensens left a 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

@@ -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('//')
Copy link
Member

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)

Copy link
Member

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)
Copy link
Member

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants