Skip to content

Commit

Permalink
fix tg_id to int multiple, timeout snad cross 5 sec
Browse files Browse the repository at this point in the history
  • Loading branch information
Knispel2 committed Jun 25, 2024
1 parent 0c37c9f commit 00e9fab
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions fink_filters/filter_anomaly_notification/filter_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -301,6 +301,7 @@ def load_to_anomaly_base(data, model):
tg_id_data = requests.get(url=f'https://fink.matwey.name:443/user/get_tgid/{username}')
if status_check(tg_id_data, 'tg_id loading'):
tg_id_data = tg_id_data.content.decode('utf-8')
tg_id_data = int(tg_id_data.replace('"', ''))
else:
tg_id_data = 'ND'

Expand Down Expand Up @@ -328,7 +329,7 @@ def load_to_anomaly_base(data, model):
# send in tg personal
if tg_id_data == 'ND':
continue
tg_id_data = int(tg_id_data.replace('"', ''))

inline_keyboard = {
"inline_keyboard": [
[
Expand Down Expand Up @@ -397,7 +398,9 @@ def get_OID(ra, dec):
ZTF DR OID
'''
r = requests.get(
url=f'http://db.ztf.snad.space/api/v3/data/latest/circle/full/json?ra={ra}&dec={dec}&radius_arcsec=1')
url=f'http://db.ztf.snad.space/api/v3/data/latest/circle/full/json?ra={ra}&dec={dec}&radius_arcsec=1',
timeout=5
)
if not status_check(r, 'get cross from snad'):
return None
oids = [key for key, _ in r.json().items()]
Expand Down

0 comments on commit 00e9fab

Please sign in to comment.