mirror of
https://github.com/kennethreitz/python-github3.git
synced 2026-06-05 23:10:17 +00:00
I guess api tokens are deprecated now :(
This commit is contained in:
+13
-13
@@ -41,21 +41,21 @@ def basic_auth(username, password):
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
def git_config():
|
# def git_config():
|
||||||
"""Returns an authenticated Github object, via HTTP Basic.
|
# """Returns an authenticated Github object, via HTTP Basic.
|
||||||
|
|
||||||
GitHub API token is taken from `git config`.
|
# GitHub API token is taken from `git config`.
|
||||||
"""
|
# """
|
||||||
|
|
||||||
username = envoy.run('git config github.user').std_out.strip()
|
# username = envoy.run('git config github.user').std_out.strip()
|
||||||
token = envoy.run('git config github.token').std_out.strip()
|
# token = envoy.run('git config github.token').std_out.strip()
|
||||||
|
|
||||||
def enable_auth(*args, **kwargs):
|
# def enable_auth(*args, **kwargs):
|
||||||
kwargs['auth'] = (username, token)
|
# kwargs['auth'] = (username, token)
|
||||||
return args, kwargs
|
# return args, kwargs
|
||||||
|
|
||||||
gh = Github()
|
# gh = Github()
|
||||||
gh.is_authenticated = True
|
# gh.is_authenticated = True
|
||||||
gh._requests_pre_hook = enable_auth
|
# gh._requests_pre_hook = enable_auth
|
||||||
|
|
||||||
return gh
|
# return gh
|
||||||
Reference in New Issue
Block a user