Advertisement
Guest User

Untitled

a guest
May 3rd, 2023
991
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 1.37 KB | None | 0 0
  1. import requests
  2.  
  3.  
  4. def get_url_encoded_object(data):
  5.     form_body = []
  6.     for key, value in data.items():
  7.         encoded_key = requests.utils.quote(key)
  8.         encoded_value = requests.utils.quote(value)
  9.         form_body.append(encoded_key + "=" + encoded_value)
  10.     form_body = "&".join(form_body)
  11.     return form_body
  12.  
  13.  
  14. def request_token_creation():
  15.     data = {
  16.         "response_type": "code",
  17.         "client_id": "qiwi_wallet_api",
  18.         "client_software": "WEB v4.96.0",
  19.         "username": "тут номер киви кошелька",
  20.         "scope": "read_person_profile read_balance read_payment_history accept_payments get_virtual_cards_requisites write_ip_whitelist",
  21.         "token_head": "тут head token",
  22.         "token_head_client_id": "web-qw"
  23.     }
  24.     headers = {
  25.         "Content-Type": "application/x-www-form-urlencoded",
  26.         "Cookie": "тут куки с сайта киви"
  27.     }
  28.     response = requests.post("https://qiwi.com/oauth/authorize", headers=headers, data=get_url_encoded_object(data))
  29.     print(response.content)
  30.     if response.status_code != 200 or "code" not in response.json():
  31.         print(response.text)
  32.    
  33.     else:
  34.         # ТУТ ЖДЕМ СМС КОД И ПОТОМ ЗАПУСКАЕМ ВТОРУЮ ФУНКЦИЮ С ПАРАМЕТРОМ response.json()["code"]
  35.         pass
  36. request_token_creation()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement