fix bug
This commit is contained in:
parent
255bcb3a25
commit
fe3a0f3e07
@ -6,7 +6,7 @@ import time
|
|||||||
import tg
|
import tg
|
||||||
import traceback
|
import traceback
|
||||||
import logging
|
import logging
|
||||||
|
import json
|
||||||
|
|
||||||
def run():
|
def run():
|
||||||
try:
|
try:
|
||||||
@ -16,12 +16,13 @@ def run():
|
|||||||
url = f'https://api.whale-alert.io/v1/transactions?api_key={settings.whaleAlert_apikey}&start={start_ts}&min_value={settings.whaleAlert_max_limit}'
|
url = f'https://api.whale-alert.io/v1/transactions?api_key={settings.whaleAlert_apikey}&start={start_ts}&min_value={settings.whaleAlert_max_limit}'
|
||||||
headers = {'Accept': 'application/json'}
|
headers = {'Accept': 'application/json'}
|
||||||
|
|
||||||
resp = requests.get(url, headers=headers).json()
|
resp = requests.get(url, headers=headers).text
|
||||||
|
data = json.loads(resp)
|
||||||
print(resp)
|
|
||||||
if resp['result'] == "success":
|
print(data)
|
||||||
if 'transactions' in resp:
|
if data['result'] == "success":
|
||||||
data = resp['transactions']
|
if 'transactions' in data:
|
||||||
|
data = data['transactions']
|
||||||
|
|
||||||
for ts in data:
|
for ts in data:
|
||||||
if ts['to']['owner_type'] == 'exchange':
|
if ts['to']['owner_type'] == 'exchange':
|
||||||
@ -38,8 +39,9 @@ def run():
|
|||||||
tg.send_message(settings.chat_id, content)
|
tg.send_message(settings.chat_id, content)
|
||||||
|
|
||||||
else:
|
else:
|
||||||
print(resp['message'])
|
print(data)
|
||||||
tg.send_message(settings.chat_id, resp['message'])
|
tg.send_message(settings.chat_id, data['message'])
|
||||||
except:
|
except:
|
||||||
|
print(resp)
|
||||||
logging.error(traceback.format_exc())
|
logging.error(traceback.format_exc())
|
||||||
tg.send_message(settings.chat_id, traceback.format_exc())
|
tg.send_message(settings.chat_id, traceback.format_exc())
|
||||||
Loading…
Reference in New Issue
Block a user