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

utils.fetch_if_not_cached needs response return #660

Open
stucka opened this issue Aug 29, 2024 · 0 comments
Open

utils.fetch_if_not_cached needs response return #660

stucka opened this issue Aug 29, 2024 · 0 comments
Assignees

Comments

@stucka
Copy link
Contributor

stucka commented Aug 29, 2024

A number of scrapers are using utils.fetch_if_not_cached, which itself will flag errors but they don't get passed back to the main program. See handling of get_url as an example.

This disallows the use of response.raise_for_status() in the main code.

However, fetch_if_not_cached would not be able to return a response object if it doesn't need to download something; in this case, that response can be faked: https://stackoverflow.com/posts/23914464/revisions

... and thus allow for consistent code.

Existing scrapers using this function would need to be updated:
ga (x2)
or
tn

@stucka stucka self-assigned this Aug 29, 2024
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

1 participant