Skip to content

Commit

Permalink
Merge pull request houtianze#247 from saltyang/master
Browse files Browse the repository at this point in the history
Add in function auto_auth() with auth_code (Because refresh_token doesn't work).
  • Loading branch information
houtianze committed May 31, 2016
2 parents 789bda6 + c6a3a02 commit 28215b7
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions bypy.py
Original file line number Diff line number Diff line change
Expand Up @@ -1960,6 +1960,26 @@ def __server_auth(self):
self.__prompt_clean()

return result

def auto_auth(self, auth_code):
pars = {
'code' : auth_code,
'redirect_uri' : 'oob' }

result = None
for auth in AuthServerList:
(url, retry, msg) = auth
pr(msg)
result = self.__get(url, pars, self.__server_auth_act, retry = retry, addtoken = False)
if result == ENoError:
break

if result == ENoError:
pr("Successfully authorized")
else:
perr("Fatal: All server authorizations failed.")

return result

def __device_auth_act(self, r, args):
dj = r.json()
Expand Down

0 comments on commit 28215b7

Please sign in to comment.