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

Error handling #19

Open
piotrdrazikowski opened this issue Aug 17, 2020 · 1 comment
Open

Error handling #19

piotrdrazikowski opened this issue Aug 17, 2020 · 1 comment
Labels
enhancement New feature or request

Comments

@piotrdrazikowski
Copy link

When iterating through BWQueries.iter_mentions() there's no way to keep track of current page, retry or skip a page that yields an error. What's more, internal server errors remain uncaught - there's error key in the response, but the code looks for errors: https://github.com/BrandwatchLtd/bcr-api/blob/master/src/bcr_api/bwdata.py#L993

@steve-mavens
Copy link

steve-mavens commented Nov 26, 2020

I've worked around this by dynamically patching the BWUser.request method, with a version decorated using https://pypi.org/project/retry/

So, one approach to solving this is to add the retries there (although the decorator won't skip a failed page, just retry until it gives up and raises). The problem is you have to decide what parameters to give to retry(), and different users might have different needs. I don't know whether everyone else is on the same API rate limit that my account is, for example, so the numbers I used might not be appropriate in general.

@pfairfax1 pfairfax1 added the enhancement New feature or request label Jul 6, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants