RafaelWO / unparallel

Create async web requests via Python in no time.
https://rafaelwo.github.io/unparallel/
MIT License
10 stars 0 forks source link

Make response processing configurable #100

Closed RafaelWO closed 8 months ago

RafaelWO commented 10 months ago

🚀 Feature Request

Currently, Unparallel will always return the output of response.json() for every request. However, one would like just to get the status code or the HTML/text result.

Add a parameter to the up(...) to control the returned response. We could use the httpx.Response as the type for a parameter response. E.g. the default would be response=httpx.Response.json. The parameter type should be a callable and should also allow lambdas for custom control of the results.

🔈 Motivation

For example, this user wants to return True/False based on the status code. Unparallel should support this use case.

Moreover, one cannot use the supported HTTP method HEAD now because it has no JSON body. Having this feature would enable it.

🛰 Alternatives

n/a

📎 Additional context

n/a