proper requests authentication

This commit is contained in:
Kenneth Reitz
2011-10-19 02:36:09 -04:00
parent 59b7dd6d40
commit 68ba47c464
4 changed files with 17 additions and 30 deletions
+1 -5
View File
@@ -29,13 +29,9 @@ def no_auth():
def basic_auth(username, password):
"""Returns an authenticated Github object, via HTTP Basic."""
def enable_auth(*args, **kwargs):
kwargs['auth'] = (username, password)
return args, kwargs
gh = Github()
gh.is_authenticated = True
gh._requests_pre_hook = enable_auth
gh.session.auth = (username, password)
return gh