[Bf-extensions-cvs] [c1cdc9cf] master: BlenderKit: make download more robust
Vilém Duha
noreply at git.blender.org
Tue Jan 7 11:43:58 CET 2020
Commit: c1cdc9cf23976c928e915aa14493981e343e50f6
Author: Vilém Duha
Date: Mon Jan 6 15:36:18 2020 +0100
Branches: master
https://developer.blender.org/rBAc1cdc9cf23976c928e915aa14493981e343e50f6
BlenderKit: make download more robust
===================================================================
M blenderkit/download.py
===================================================================
diff --git a/blenderkit/download.py b/blenderkit/download.py
index c6d22749..296a7639 100644
--- a/blenderkit/download.py
+++ b/blenderkit/download.py
@@ -741,17 +741,16 @@ def get_download_url(asset_data, scene_id, api_key, tcom=None):
data = {
'scene_uuid': scene_id
}
- r = None
try:
r = rerequests.get(asset_data['download_url'], params=data, headers=headers)
except Exception as e:
print(e)
if tcom is not None:
tcom.error = True
-
if r == None:
- tcom.report = 'Connection Error'
- tcom.error = True
+ if tcom is not None:
+ tcom.report = 'Connection Error'
+ tcom.error = True
return 'Connection Error'
if r.status_code < 400:
@@ -763,14 +762,17 @@ def get_download_url(asset_data, scene_id, api_key, tcom=None):
if r.status_code == 403:
r = 'You need Full plan to get this item.'
- tcom.report = r
r1 = 'All materials and brushes are available for free. Only users registered to Standard plan can use all models.'
tasks_queue.add_task((ui.add_report, (r1, 5, colors.RED)))
- tcom.error = True
+ if tcom is not None:
+ tcom.report = r
+ tcom.error = True
elif r.status_code >= 500:
- tcom.report = 'Server error'
- tcom.error = True
+ utils.p(r.text)
+ if tcom is not None:
+ tcom.report = 'Server error'
+ tcom.error = True
return False
More information about the Bf-extensions-cvs
mailing list