Skip to content

[Feature Request]: Retry on bad responses #26

@plum-pan

Description

@plum-pan

The idea

This I suppose is more a question of approach rather than a specific request for a feature.

I've found in my use (generating RSS feeds from a list of accounts), FA will throw bad requests back at you on a semi regular basis. Usually a 520, sometimes something that makes Requests throw a ChunkedEncodingError. Probably under 1% of the time, but when I'm debugging and having to rebuild my entire feed list with ~100 users, even with only one page of submissions and journals per user, it's pretty likely to hit.

So I could handle this on my side, wrap a function around every time I call faapi and tell it to wait 5 seconds and retry once if it throws an error. But it seemed a little weird to have to try and wrap different functions so, for my own use, I just went into FAAPI and hacked in a quick try except loop around get().

Ultimately is this something that should be handled on FAAPI's side, maybe just a setting to attempt one or two retries before giving up, or should this be something that the user builds around the FAAPI library? If it's the later, what's a good way to go about wrapping that around multiple functions all at once, i.e. faapi.gallery(),faapi.journals(), faapi.scraps(), etc.

Implementation ideas

except (requests.exceptions.HTTPError, 
requests.exceptions.ChunkedEncodingError) as e:

Metadata

Metadata

Labels

enhancementNew feature or request

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions