MCPcopy
hub / github.com/constverum/ProxyBroker / fetch

Function fetch

examples/proxy_server.py:11–25  ·  view source on GitHub ↗
(url, proxy_url)

Source from the content-addressed store, hash-verified

9
10
11async 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
28async def get_pages(urls, proxy_url):

Callers 1

get_pagesFunction · 0.70

Calls 1

getMethod · 0.45

Tested by

no test coverage detected