Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bad Gateway errors #165

Open
denismaier opened this issue Aug 16, 2023 · 5 comments
Open

Bad Gateway errors #165

denismaier opened this issue Aug 16, 2023 · 5 comments

Comments

@denismaier
Copy link

I've started getting "Bad gateway" errors in a script that previously was working flawlessly.

pyzotero.zotero_errors.HTTPError:
Code: 504
URL: https://api.zotero.org/groups/1234567890/items/top?itemType=book&limit=100&start=300
Method: GET
Response: <html>
<head><title>504 Gateway Time-out</title></head>
<body>
<center><h1>504 Gateway Time-out</h1></center>
</body>
</html>

How does pyzotero handle these kinds of errors? Do I need to handle the error catching in my script, or is there a way to let pyzotero retry whatever it was trying to do?

@urschrei
Copy link
Owner

You'll need to catch the HTTPError exception and handle the retry logic yourself – Pyzotero only retries 429 errors as there isn't really a one-size-fits-all approach to HTTP errors beyond that, IMO.

@denismaier
Copy link
Author

Ok. thanks. I'll have a look. (Only thing that gives me headaches is that I'm using the everything retrieving method, and the error occurs after a couple of successfull retrievals, and I don't know how to resume where things went wrong instead of making a completely new start.)

@urschrei
Copy link
Owner

Since the error returns the URL, you could extract the start parameter (300) in your example above, and use that as input for whichever top query you were running – they should all accept e.g. a start=300 param.

@denismaier
Copy link
Author

Sounds good---but are the successful requests preserved somewhere so I can just add to them?

@urschrei
Copy link
Owner

I'll have to think about it, but I think that's going to be very difficult…

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants