Skip to content

Commit

Permalink
feat: handle 400 Bad Request error caused by different uploder
Browse files Browse the repository at this point in the history
  • Loading branch information
Ovler-Young committed Dec 1, 2024
1 parent adbb893 commit 9431074
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions biliarchiver/_biliarchiver_upload_bvid.py
Original file line number Diff line number Diff line change
Expand Up @@ -302,6 +302,12 @@ def _upload_bvid(
assert isinstance(r, Response)
r.raise_for_status()
except HTTPError as e:
if e.response.status_code == 400:
print(f"400 Bad Request error encountered for {remote_identifier}. No more retries will be attempted.")
print(f"Error message: {e.response.text}")
if item.metadata.get("uploader") != get_username(access_key=access_key, secret_key=secret_key):
print(f"{remote_identifier} {_('不是你上传的,跳过')} (item.metadata.creator)")
return
if e.response.status_code == 403:
print(f"403 Forbidden error encountered for {remote_identifier}. Retrying with title as description.")
new_md["description"] = md["title"]
Expand Down

0 comments on commit 9431074

Please sign in to comment.