Home  >  Q&A  >  body text

python aiohttp download pictures

I use asyncio to download pictures. I can download them but cannot open them

@asyncio.coroutine # <3>
def get_flag(cc):

print(6)
resp = yield from aiohttp.request('GET', cc)  # <4>
image = yield from resp.read()  # <5>
##########有问题
return image
//////////////////////////////////////
上边是代码,能够request,但是在read的时候就出现问题了,cc是图片的路径
给我你的怀抱给我你的怀抱2598 days ago956

reply all(1)I'll reply

  • 高洛峰

    高洛峰2017-07-05 10:36:44

    Shouldn’t it be resp.content

    reply
    0
  • Cancelreply