-
I have many links to download, but many of them is not of desired content type. i.e. I'm just interested in |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
You could just make your requests in streaming mode and not read the content. https://www.python-httpx.org/quickstart/#streaming-responses The last example in that section of the docs is basically your use case: >>> with httpx.stream("GET", "https://www.example.com") as r:
... if r.headers['Content-Length'] < TOO_LONG:
... r.read()
... print(r.text) |
Beta Was this translation helpful? Give feedback.
You could just make your requests in streaming mode and not read the content. https://www.python-httpx.org/quickstart/#streaming-responses
The last example in that section of the docs is basically your use case: