Browse Source

(fix) base64 for python 2/3

master
Alexeev Nickolay 6 years ago
parent
commit
19e564a69b
  1. 3
      yandex_connect/base.py

3
yandex_connect/base.py

@ -25,8 +25,9 @@ def token_get_by_code():
code = input('Enter code: ') code = input('Enter code: ')
auth = '%s:%s' % (client_id, client_secret) auth = '%s:%s' % (client_id, client_secret)
auth_base64 = base64.encodestring(auth.encode()).decode("utf-8")
headers = { headers = {
"Authorization": "Basic %s" % base64.b64encode(auth).replace('\n', '').strip() "Authorization": "Basic %s" % auth_base64.replace('\n', '').strip()
} }
r = requests.post( r = requests.post(
'https://oauth.yandex.ru/token', 'https://oauth.yandex.ru/token',

Loading…
Cancel
Save