-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathutils.py
65 lines (51 loc) · 1.5 KB
/
utils.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
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
from cryptography.fernet import Fernet
import requests
import ujson
# to generate your key: Fernet().generate_key()
KEY = Fernet.generate_key()
f = Fernet(KEY)
def save_user_data(data: dict):
encrypted_data = f.encrypt(ujson.dumps(data).encode())
try:
with open('user_data', 'wb') as data:
data.write(encrypted_data)
except:
pass
def get_user_data() -> dict:
try:
with open('user_data', 'rb') as data:
decrypt_data = ujson.loads(f.decrypt(data.read()).decode())
return decrypt_data
except:
return {}
def send_balance(from_key, to_key, amount, pay_pass):
url = f"https://market.csgo.com/api/v2/money-send/{amount}/{to_key}"
params = {
"pay_pass": pay_pass,
"key": from_key
}
r = requests.get(url, params=params, timeout=20)
return r
def send_wax_balance(from_key: str, steam_id: str, amount: int):
url = "https://api.waxpeer.com/v1/transfer-money/"
params = {
"api": from_key,
"steam_id": steam_id,
"amount": amount
}
r = requests.post(url, params=params)
return r
def get_tm_balance(api_key: str):
url = "https://market.csgo.com/api/v2/get-money"
params = {
"key": api_key
}
r = requests.get(url, params=params, timeout=20)
return r
def get_wax_balance(api_key: str):
url = "https://api.waxpeer.com/v1/user"
params = {
"api": api_key
}
r = requests.get(url, params=params, timeout=20)
return r