Answer the question
In order to leave comments, you need to log in
How to get a YooMoney token (Yandex money)?
I do everything by api.
The essence of the problem: Yandex Money does not send a token to my server.
from flask import Flask, request, redirect
import logging
logging.basicConfig(filename="logs.log", level=logging.INFO)
app = Flask(__name__)
@app.route('/')
def get_onetime_code():
logging.info(request.url)
data = request.args
code = data['code']
client_id = 'client'
return redirect('https://yoomoney.ru/oauth/token?code={}&client_id={}&grant_type=authorization_code&redirect_uri=http://me.pythonanywhere.com/reg'.format(code, client_id), code=302)
@app.route('/reg')
def get_code():
logging.info(request.url)
data = request.args
f = open('data.txt', 'w')
f.write(str(data['code']))
f.close()
return 'ok'
if __name__ == '__main__':
app.run(debug = True)
INFO:root:http://me.pythonanywhere.com/?code=code
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question