forked from plushkinv/pilotdog-cheker
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.py
70 lines (53 loc) · 2.38 KB
/
main.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
66
67
68
69
import asyncio
import csv
import json
import requests
import config
from loguru import logger
class Checker:
def __init__(self, wallet):
self.wallet = wallet
async def check(self):
print(".")
for _ in range(5):
try:
if config.proxy_use:
result = requests.get(url="https://www.pilotdog.tech/api/get_eligible?address="+self.wallet, proxies=config.proxies)
else:
result = requests.get(url="https://www.pilotdog.tech/api/get_eligible?address="+self.wallet)
if result.status_code == 200:
data = json.loads(result.text)
drop = data['data']['claimable_amount']
return self.wallet, drop
break # Прерываем цикл, если запрос успешно выполнен
except requests.exceptions.RequestException as e:
# Обрабатываем ошибку подключения
print(".")
continue # Повторяем попытку подключения
return 'error'
async def write_to_csv(wallet, drop):
with open('result.csv', 'a', newline='') as file:
writer = csv.writer(file)
if file.tell() == 0:
writer.writerow(['wallet', 'drop'])
writer.writerow([wallet, drop])
async def main():
print(f'============================================= Плюшкин Блог =============================================')
print(f'subscribe to : https://t.me/plushkin_blog \n============================================================================================================\n')
with open("wallets.txt", "r") as f:
wallets = [row.strip() for row in f]
batches = [wallets[i:i + config.amount_wallets_in_batch] for i in range(0, len(wallets), config.amount_wallets_in_batch)]
for batch in batches:
tasks = []
for wallet in batch:
checker1 = Checker(wallet)
tasks.append(checker1.check())
res = await asyncio.gather(*tasks)
for res_ in res:
wallet, drop= res_
await write_to_csv(wallet, drop)
tasks = []
if __name__ == '__main__':
# Запускаем цикл событий
results = asyncio.run(main())
logger.success(f'типа все!')