refac
This commit is contained in:
1 parent
2fcb36267f
commit
0c7ddbdb4f
1 file changed
+9
-5
@@ -96,11 +96,15 @@ def get_license_data(app, key):
|
|||||||
setattr(app.state, 'LICENSE_METADATA', v)
|
setattr(app.state, 'LICENSE_METADATA', v)
|
||||||
|
|
||||||
def handler(u):
|
def handler(u):
|
||||||
res = requests.post(
|
try:
|
||||||
f'{u}/api/v1/license/',
|
res = requests.post(
|
||||||
json={'key': key, 'version': '1'},
|
f'{u}/api/v1/license/',
|
||||||
timeout=5,
|
json={'key': key, 'version': '1'},
|
||||||
)
|
timeout=5,
|
||||||
|
)
|
||||||
|
except Exception as ex:
|
||||||
|
log.error(f'License: retrieval issue from {u}: {ex}')
|
||||||
|
return False
|
||||||
|
|
||||||
if getattr(res, 'ok', False):
|
if getattr(res, 'ok', False):
|
||||||
payload = getattr(res, 'json', lambda: {})()
|
payload = getattr(res, 'json', lambda: {})()
|
||||||
|
|||||||
Reference in new issue
Block a user