fix: Catch errors fir no records returned via API
This commit is contained in:
parent
f49a14c5b2
commit
0ca9a8ac91
8
varo.py
8
varo.py
@ -67,8 +67,9 @@ def get_auth_id(domain):
|
||||
}
|
||||
r = requests.post(url, headers=headers, json=data)
|
||||
r = r.json()
|
||||
if 'data' not in r:
|
||||
return ""
|
||||
for record in r['data']:
|
||||
if record['name'] == domain + "." + city_domain:
|
||||
if 'profile avatar=' not in record['content']:
|
||||
return record['uuid']
|
||||
return ""
|
||||
@ -91,8 +92,10 @@ def get_auth(domain):
|
||||
}
|
||||
r = requests.post(url, headers=headers, json=data)
|
||||
r = r.json()
|
||||
if 'data' not in r:
|
||||
return ""
|
||||
|
||||
for record in r['data']:
|
||||
if record['name'] == domain + "." + city_domain:
|
||||
if 'profile avatar=' not in record['content']:
|
||||
return record['content']
|
||||
return ""
|
||||
@ -149,6 +152,7 @@ def update_avatar(avatar,domain):
|
||||
r = requests.post(url, headers=headers, json=data)
|
||||
r = r.json()
|
||||
record_id = ""
|
||||
if 'data' in r:
|
||||
for record in r['data']:
|
||||
if record['name'] == domain + "." + city_domain:
|
||||
if 'profile avatar=' in record['content']:
|
||||
|
Loading…
Reference in New Issue
Block a user