Police-Data-Accessibility-Project / data-sources-app

An API and UI for using and maintaining the Data Sources database
MIT License
2 stars 4 forks source link

add timeout to requests calls #298

Open josh-chamberlain opened 1 month ago

josh-chamberlain commented 1 month ago

https://github.com/Police-Data-Accessibility-Project/data-sources-app/pull/260

I'd probably want to make it so that we're calling a singular function which makes the request with the necessary parameters rather than having to put the same argument in every call to requests.get().

maxachis commented 1 month ago

Rather than creating a custom function for this, we could probably use the httpx library, which includes timeouts by default. Here's an overview of how it compares to requests, and here is a piece of httpx documentation discussing how its functionality compares to requests.

Then again, it may be overkill to add an entirely new module just because of one default functionality.