Не получается авторизоваться на яндекс деньги, вроде делаю всё по инструкции:
Мой код:
#!/usr/bin/python # -*- coding: utf-8 -*- import urllib import urllib2 import json # Fill in this consts your values CLIENT_ID = '6D3FD82502F95CC490D4297F871AB2B934597432FE48B681025011F50C079***' YM_REDIRECT_URI = 'https://testapp.ru/s' SCOPE = 'account-info operation-history' # Links for full version of yandex.money. URI_YM_API = 'https://money.yandex.ru/api' URI_YM_AUTH = 'https://sp-money.yandex.ru/oauth/authorize' URI_YM_TOKEN = 'https://sp-money.yandex.ru/oauth/token' def ym_auth(): headers = { 'Host': 'sp-money.yandex.ru', 'Content-Type': 'application/x-www-form-urlencoded;charset=UTF-8', 'Content-Length': '154' } params = urllib.urlencode({ 'client_id': CLIENT_ID, 'response_type': 'code', 'redirect_uri': YM_REDIRECT_URI, 'scope': SCOPE }) req = urllib2.Request(URI_YM_AUTH, params, headers) response = urllib2.urlopen(req) print response.read() print response.info().items() ym_auth()
он ведь в заголовке должен вернуть
HTTP/1.1 302 Found
Location: https://client.example.com/cb?code=i1WsRn1uB1ehfbb37
?