{"action":"opened","issue":{"url":"https://api.github.com/repos/hippoKnight/WebCrawler/issues/12","repository_url":"https://api.github.com/repos/hippoKnight/WebCrawler","labels_url":"https://api.github.com/repos/hippoKnight/WebCrawler/issues/12/labels{/name}","comments_url":"https://api.github.com/repos/hippoKnight/WebCrawler/issues/12/comments","events_url":"https://api.github.com/repos/hippoKnight/WebCrawler/issues/12/events","html_url":"https://github.com/hippoKnight/WebCrawler/issues/12","id":240455971,"number":12,"title":"asynchronously download one image with aiohttp","user":{"login":"hippoKnight","id":6011391,"avatar_url":"https://avatars3.githubusercontent.com/u/6011391?v=3","gravatar_id":"","url":"https://api.github.com/users/hippoKnight","html_url":"https://github.com/hippoKnight","followers_url":"https://api.github.com/users/hippoKnight/followers","following_url":"https://api.github.com/users/hippoKnight/following{/other_user}","gists_url":"https://api.github.com/users/hippoKnight/gists{/gist_id}","starred_url":"https://api.github.com/users/hippoKnight/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/hippoKnight/subscriptions","organizations_url":"https://api.github.com/users/hippoKnight/orgs","repos_url":"https://api.github.com/users/hippoKnight/repos","events_url":"https://api.github.com/users/hippoKnight/events{/privacy}","received_events_url":"https://api.github.com/users/hippoKnight/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2017-07-04T15:47:42Z","updated_at":"2017-07-04T15:47:42Z","closed_at":null,"body":"https://myridia.com/dev_posts/view/1623\r\n```\r\n#!/usr/bin/env python\r\nimport asyncio\r\nimport aiohttp\r\n\r\nasync def fetch_img(session, url):\r\n  with aiohttp.Timeout(10):\r\n    async with session.get(url) as response:\r\n      assert response.status == 200\r\n      return await response.read()\r\n\r\nloop = asyncio.get_event_loop()\r\nwith aiohttp.ClientSession(loop=loop) as session:\r\n  img = loop.run_until_complete(\r\n    fetch_img(session,'http://httpbin.org/image/png'))\r\n  with open(\"img.png\", \"wb\") as f:\r\n    f.write(img)\r\n```"}}
{"actor":{"display_login":"hippoKnight"}}