Spaces:
Runtime error
Runtime error
Felix Marty
commited on
Commit
·
b23ba47
1
Parent(s):
0c661e5
add try catch
Browse files- backend.py +9 -1
backend.py
CHANGED
|
@@ -71,7 +71,10 @@ def send_single(input_model_vanilla, address: str):
|
|
| 71 |
address, headers=HEADERS, data=input_model_vanilla.encode("utf-8")
|
| 72 |
)
|
| 73 |
|
| 74 |
-
|
|
|
|
|
|
|
|
|
|
| 75 |
|
| 76 |
status = response.status_code
|
| 77 |
|
|
@@ -110,6 +113,11 @@ def send_spam(address: str):
|
|
| 110 |
promises.append(SESSION.post(address, headers=HEADERS, data=input_data))
|
| 111 |
|
| 112 |
for promise in promises:
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 113 |
response = promise.result()
|
| 114 |
|
| 115 |
response_text = json.loads(response.text)
|
|
|
|
| 71 |
address, headers=HEADERS, data=input_model_vanilla.encode("utf-8")
|
| 72 |
)
|
| 73 |
|
| 74 |
+
try:
|
| 75 |
+
response = promise.result() # resolve ASAP
|
| 76 |
+
except Exception as e:
|
| 77 |
+
return f"{e}"
|
| 78 |
|
| 79 |
status = response.status_code
|
| 80 |
|
|
|
|
| 113 |
promises.append(SESSION.post(address, headers=HEADERS, data=input_data))
|
| 114 |
|
| 115 |
for promise in promises:
|
| 116 |
+
try:
|
| 117 |
+
response = promise.result() # resolve ASAP
|
| 118 |
+
except Exception as e:
|
| 119 |
+
return f"{e}"
|
| 120 |
+
|
| 121 |
response = promise.result()
|
| 122 |
|
| 123 |
response_text = json.loads(response.text)
|