Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import requests
- def get_url_encoded_object(data):
- form_body = []
- for key, value in data.items():
- encoded_key = requests.utils.quote(key)
- encoded_value = requests.utils.quote(value)
- form_body.append(encoded_key + "=" + encoded_value)
- form_body = "&".join(form_body)
- return form_body
- def request_token_creation():
- data = {
- "response_type": "code",
- "client_id": "qiwi_wallet_api",
- "client_software": "WEB v4.96.0",
- "username": "тут номер киви кошелька",
- "scope": "read_person_profile read_balance read_payment_history accept_payments get_virtual_cards_requisites write_ip_whitelist",
- "token_head": "тут head token",
- "token_head_client_id": "web-qw"
- }
- headers = {
- "Content-Type": "application/x-www-form-urlencoded",
- "Cookie": "тут куки с сайта киви"
- }
- response = requests.post("https://qiwi.com/oauth/authorize", headers=headers, data=get_url_encoded_object(data))
- print(response.content)
- if response.status_code != 200 or "code" not in response.json():
- print(response.text)
- else:
- # ТУТ ЖДЕМ СМС КОД И ПОТОМ ЗАПУСКАЕМ ВТОРУЮ ФУНКЦИЮ С ПАРАМЕТРОМ response.json()["code"]
- pass
- request_token_creation()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement