mirror of
https://github.com/kennethreitz/python-github3.git
synced 2026-06-05 23:10:17 +00:00
proper requests authentication
This commit is contained in:
+1
-5
@@ -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
|
||||
|
||||
|
||||
Reference in New Issue
Block a user