8000 Fix doc-strings and github3.login · zzKuRtzz/github3.py@4d95713 · GitHub
[go: up one dir, main page]

Skip to content

Commit 4d95713

Browse files
committed
Fix doc-strings and github3.login
1 parent 9119bb3 commit 4d95713

File tree

2 files changed

+10
-5
lines changed

2 files changed

+10
-5
lines changed

github3/api.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,8 @@ def authorize(login, password, scopes, note='', note_url='', client_id='',
3434
client_secret)
3535

3636

37-
def login(username=None, password=None, token=None, url=None):
37+
def login(username=None, password=None, token=None, url=None,
38+
two_factor_callback=None):
3839
"""Construct and return an authenticated GitHub session.
3940
4041
This will return a GitHubEnterprise session if a url is provided.
@@ -43,14 +44,16 @@ def login(username=None, password=None, token=None, url=None):
4344
:param str password: password for the login
4445
:param str token: OAuth token
4546
:param str url: (optional), URL of a GitHub Enterprise instance
47+
:param func two_factor_callback: (optional), function you implement to
48+
provide the Two Factor Authentication code to GitHub when necessary
4649
:returns: :class:`GitHub <github3.github.GitHub>`
4750
4851
"""
4952
g = None
5053

5154
if (username and password) or token:
5255
g = GitHubEnterprise(url) if url is not None else GitHub()
53-
g.login(username, password, token)
56+
g.login(username, password, token, two_factor_callback)
5457

5558
return g
5659

github3/github.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -857,9 +857,11 @@ def login(self, username=None, password=None, token=None,
857857
two_factor_callback=None):
858858
"""Logs the user into GitHub for protected API calls.
859859
860-
:param str username: (optional)
861-
:param str password: (optional)
862-
:param str token: (optional)
860+
:param str username: login name
861+
:param str password: password for the login
862+
:param str token: OAuth token
863+
:param func two_factor_callback: (optional), function you implement to
864+
provide the Two Factor Authentication code to GitHub when necessary
863865
"""
864866
if username and password:
865867
self._session.basic_auth(username, password)

0 commit comments

Comments
 (0)
0