-
Notifications
You must be signed in to change notification settings - Fork 2
/
balance.py
46 lines (40 loc) · 945 Bytes
/
balance.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
import json
import hmac
import time
import requests
from hashlib import sha256
api_key = 'EEFA1913EA9D9351469B1E5D852A'
data = {
"shop_id": "1913EA935149B1E5D852A",
"nonce": 1613435880,
"currency": "RUB",
"amount": 1200,
"order_id": "test order",
"payment_system": 5,
"fields": {
"email": "[email protected]",
"phone": "79111231212"
},
"receipt": {
"items": [
{
"name": "test item 1",
"count": 1,
"price": 600
},
{
"name": "test item 2",
"count": 1,
"price": 600
}
]
}
}
body = json.dumps(data)
sign = hmac.new(api_key.encode(), body.encode(), sha256).hexdigest()
headers = {
'Authorization': f'Bearer {sign}',
'Content-Type': 'application/json',
}
response = requests.post("https://tegro.money/api/balance/", data=body, headers=headers)
print(response.text)