(20250825) - changed lib aiohttps to httpx lib

This commit is contained in:
yatmesh
2025-09-25 15:52:41 +05:30
parent 1c54b60cff
commit 379fb67aae
@@ -181,17 +181,21 @@ class PlacesController(GooglePlacesController):
} }
try: try:
async with aiohttp.ClientSession() as session: async with httpx.AsyncClient(timeout=30) as client:
async with session.post(url, headers=headers, json=payload, timeout=30) as response: response = await client.post(url, headers=headers, json=payload)
print(response) print(response)
if response.status != 200:
return False if response.status_code != 200:
data = await response.json() return False
print(data)
# If key invalid, response will contain "error" data = response.json()
if "error" in data: print(data)
return False
return True # If key invalid, response will contain "error"
if "error" in data:
return False
return True
except Exception: except Exception:
return False return False