def token(self, CODE=''):
client, url = self.getCODE()
if self.checked == False:
if CODE == '':
import pdb;pdb.set_trace()
is_open = webbrowser.open_new(url)
if not is_open:
print('Please open %s' % url)
try:
# for python2.x
CODE = raw_input("Please Input the Code: ").strip()
except:
# for python3.x
CODE = input("Please Input the Code: ").strip()
try:
client.set_code(CODE)
except:
print("Maybe wrong CODE")
return
token = client.token
pkl.dump(token, open(str(self.token_file), 'wb'))
self.api = Client(self.APP_KEY, self.APP_SECRET, self.CALLBACK_URL, token)
self.checked = True
评论列表
文章目录