-
Notifications
You must be signed in to change notification settings - Fork 139
Closed
Description
In urllib3, I can use r = pool.urlopen('GET', url, preload_content=False) to stream content, and it's very useful because I can then use r.headers to get only response headers, then use r.data to get content. It seems very hard to do so in httpcore because I need to use with to wrap httpcore.stream('GET', url), but I find it's very limited, for example I have a local transparent web filter proxy, it's better to be able to fetch only response headers, filter/change response headers first, then download content later if response headers is not blocked.
In urllib3 I use:
import urllib3
p = urllib3.PoolManager()
r = p.urlopen('https://example.com', preload_content=False)
h = r.headers
# Filter h > headers, for example:
if 'google.com' in h.get('Referer'):
# Abort request
# If h is okay then
d = r.data
# Then send to client
Metadata
Metadata
Assignees
Labels
No labels