fix bug
This commit is contained in:
parent
255bcb3a25
commit
fe3a0f3e07
@ -6,7 +6,7 @@ import time
|
||||
import tg
|
||||
import traceback
|
||||
import logging
|
||||
|
||||
import json
|
||||
|
||||
def run():
|
||||
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}'
|
||||
headers = {'Accept': 'application/json'}
|
||||
|
||||
resp = requests.get(url, headers=headers).json()
|
||||
|
||||
print(resp)
|
||||
if resp['result'] == "success":
|
||||
if 'transactions' in resp:
|
||||
data = resp['transactions']
|
||||
resp = requests.get(url, headers=headers).text
|
||||
data = json.loads(resp)
|
||||
|
||||
print(data)
|
||||
if data['result'] == "success":
|
||||
if 'transactions' in data:
|
||||
data = data['transactions']
|
||||
|
||||
for ts in data:
|
||||
if ts['to']['owner_type'] == 'exchange':
|
||||
@ -38,8 +39,9 @@ def run():
|
||||
tg.send_message(settings.chat_id, content)
|
||||
|
||||
else:
|
||||
print(resp['message'])
|
||||
tg.send_message(settings.chat_id, resp['message'])
|
||||
print(data)
|
||||
tg.send_message(settings.chat_id, data['message'])
|
||||
except:
|
||||
print(resp)
|
||||
logging.error(traceback.format_exc())
|
||||
tg.send_message(settings.chat_id, traceback.format_exc())
|
||||
Loading…
Reference in New Issue
Block a user