Commit
·
2545811
1
Parent(s):
9a029ca
Add civitai-to-hf-uploader
Browse files
app.py
CHANGED
|
@@ -27,7 +27,7 @@ def download_file(url, file_path, folder, api_key=None):
|
|
| 27 |
try:
|
| 28 |
result = subprocess.run(curl_cmd, check=True, capture_output=True, text=True)
|
| 29 |
except subprocess.CalledProcessError as e:
|
| 30 |
-
if
|
| 31 |
# Try again with authorization
|
| 32 |
auth_key = api_key or os.environ.get("CIVITAI_API_KEY")
|
| 33 |
curl_cmd.extend(['-H', f'Authorization: Bearer {auth_key}'])
|
|
|
|
| 27 |
try:
|
| 28 |
result = subprocess.run(curl_cmd, check=True, capture_output=True, text=True)
|
| 29 |
except subprocess.CalledProcessError as e:
|
| 30 |
+
if '401' in e.stderr or '403' in e.stderr:
|
| 31 |
# Try again with authorization
|
| 32 |
auth_key = api_key or os.environ.get("CIVITAI_API_KEY")
|
| 33 |
curl_cmd.extend(['-H', f'Authorization: Bearer {auth_key}'])
|