Skip to content

Instantly share code, notes, and snippets.

@asvetlov
Created January 26, 2016 21:13
Show Gist options
  • Save asvetlov/64cd475d5c080a711ce4 to your computer and use it in GitHub Desktop.
Save asvetlov/64cd475d5c080a711ce4 to your computer and use it in GitHub Desktop.
async def fetch(session, url):
async with session.get(url) as resp:
if resp.headers['Content-Type'] != 'plain/text':
resp.close()
else:
text = await resp.text()
@Djayb6
Copy link

Djayb6 commented Feb 9, 2016

Hello, if just after resp.close() I do print(await resp.content.read(n)) where n is 10 for instance, I can see 10 bytes of the body whereas I was expecting the body to be empty. Does it seem correct to you ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment