(url, proxy_url)
| 9 | |
| 10 | |
| 11 | async def fetch(url, proxy_url): |
| 12 | resp = None |
| 13 | try: |
| 14 | async with aiohttp.ClientSession() as session, session.get( |
| 15 | url, proxy=proxy_url |
| 16 | ) as response: |
| 17 | resp = await response.json() |
| 18 | except ( |
| 19 | aiohttp.errors.ClientOSError, |
| 20 | aiohttp.errors.ClientResponseError, |
| 21 | aiohttp.errors.ServerDisconnectedError, |
| 22 | ) as e: |
| 23 | print('Error!\nURL: %s;\nError: %r' % (url, e)) |
| 24 | finally: |
| 25 | return (url, resp) |
| 26 | |
| 27 | |
| 28 | async def get_pages(urls, proxy_url): |