Уведомления

Группа в Telegram: @pythonsu

#1 Июнь 10, 2012 14:09:21

andreiru
От:
Зарегистрирован: 2010-11-06
Сообщения: 154
Репутация: +  0  -
Профиль   Отправить e-mail  

Работа с Яндекс Деньги api

Здравствуйте!

Не получается авторизоваться на яндекс деньги, вроде делаю всё по инструкции:

Мой код:

#!/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

?



Офлайн

#2 Июнь 11, 2012 15:42:00

Lexander
От:
Зарегистрирован: 2008-09-19
Сообщения: 1139
Репутация: +  33  -
Профиль   Отправить e-mail  

Работа с Яндекс Деньги api

andreiru
он ведь в заголовке должен вернуть
А возвращает?..



Офлайн

Board footer

Модераторировать

Powered by DjangoBB

Lo-Fi Version