-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathapi-test.py
40 lines (32 loc) · 1.24 KB
/
api-test.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
import telebot , web3,requests
from bs4 import BeautifulSoup
#api polygonscan (replace public address{ADDRESS} & apikey{KEY}
url = "https://api.polygonscan.com/api?module=account&action=txlist&address=ADDRESS&startblock=1&endblock=99999999&sort=asc&apikey=KEY"
# telegram bot connection - enter BOT key
bot = telebot.TeleBot("TOKEN", parse_mode=None)
r = requests.get(url)
r = r.json()
h = ""
while (True) :
if r["status"] == "1" :
r1 = r["result"]
r1= r1[-1]
if r1["hash"] == h :
pass
else :
h = r1["hash"]
# print("ALERT", "new hash is : ",h)
# t = "ALERT"
func = requests.get("https://polygonscan.com/tx/"+h)
soup = BeautifulSoup(func.text , 'html.parser')
func_value = soup.find(id='inputdata')
func_value = func_value.getText("Function")
t="🚨 Alert 🚨 \n"+func_value+"\n"+"tx id : \n"+ "https://polygonscan.com/tx/"+h
# replace your userid {USERID} you can use this bot for get userid : https://t.me/@userinfobot
bot.send_message(USERID,t)
else :
r = requests.get(url)
r = r.json()
r = requests.get(url)
r = r.json()
bot.infinity_polling()