@@ -81,14 +81,14 @@ def authorization(self, id_num):
81
81
json = self ._json (self ._get (url ), 200 )
82
82
return Authorization (json , self ) if json else None
83
83
84
- def authorize (self , login , password , scopes , note = '' , note_url = '' ,
84
+ def authorize (self , login , password , scopes = None , note = '' , note_url = '' ,
85
85
client_id = '' , client_secret = '' ):
86
86
"""Obtain an authorization token from the GitHub API for the GitHub
87
87
API.
88
88
89
89
:param str login: (required)
90
90
:param str password: (required)
91
- :param list scopes: (required ), areas you want this token to apply to,
91
+ :param list scopes: (optional ), areas you want this token to apply to,
92
92
i.e., 'gist', 'user'
93
93
:param str note: (optional), note about the authorization
94
94
:param str note_url: (optional), url for the application
@@ -100,10 +100,12 @@ def authorize(self, login, password, scopes, note='', note_url='',
100
100
"""
101
101
json = None
102
102
auth = self ._session .auth or (login and password )
103
- if isinstance ( scopes , list ) and auth :
103
+ if auth :
104
104
url = self._build_url ('authorizations' )
105
- data = {'scopes' : scopes , ' note' : note , 'note_url' : note_url ,
105
+ data = {'note' : note , 'note_url' : note_url ,
106
106
'client_id' : client_id , 'client_secret' : client_secret }
107
+ if scopes :
108
+ data ['scopes' ] = scopes
107
109
if self ._session .auth :
108
110
json = self ._json (self ._post (url , data = data ), 201 )
109
111
else :
0 commit comments