Host seems to deny connect call #6136
-
Hello! I am running an asyncio loop with over around ~300 endpoints on the same host (i.e api.com in the error below). Where it locally runs quite smoothly however when I am deploy the service in a kubernetes pod, I get the following error. aiohttp.client_exceptions.ClientConnectorError: Cannot connect to host api.com:443 ssl:default [Connect call failed ('x.x.x.x', 443)]) I am not sure how to go about this as I cannot reproduce it locally. I was thinking it might have to do with some proxy settings in k8s which is why i've set This is the code below, any thoughts? async def get_request(session: aiohttp.ClientSession, url):
"""Request an individual URL asynchronously."""
async with session.get(url) as resp:
result = await resp.json()
return result
async def get_requests(urls, headers):
"""Async function for requesting multiple URLs."""
timeout = aiohttp.ClientTimeout(total=None)
async with aiohttp.ClientSession(
headers=headers, timeout=timeout, trust_env=True
) as session:
tasks = []
for url in urls:
tasks.append(asyncio.ensure_future(get_request(session, url)))
results = await asyncio.gather(*tasks)
return results
|
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
Well, it can't connect. Have you tried with curl or anything else that would suggest this is an aiohttp problem? Currently, it just looks like you've got a firewall, network connection or something configured incorrectly. |
Beta Was this translation helpful? Give feedback.
Well, it can't connect. Have you tried with curl or anything else that would suggest this is an aiohttp problem? Currently, it just looks like you've got a firewall, network connection or something configured incorrectly.