From 379fb67aaedb5328deba2e615397b9ba0f7a1970 Mon Sep 17 00:00:00 2001 From: yatmesh Date: Thu, 25 Sep 2025 15:52:41 +0530 Subject: [PATCH] (20250825) - changed lib aiohttps to httpx lib --- .../software/google_places/google_places.py | 26 +++++++++++-------- 1 file changed, 15 insertions(+), 11 deletions(-) diff --git a/controllers_v2/software/google_places/google_places.py b/controllers_v2/software/google_places/google_places.py index c1cf2dc..1c7b805 100644 --- a/controllers_v2/software/google_places/google_places.py +++ b/controllers_v2/software/google_places/google_places.py @@ -181,17 +181,21 @@ class PlacesController(GooglePlacesController): } try: - async with aiohttp.ClientSession() as session: - async with session.post(url, headers=headers, json=payload, timeout=30) as response: - print(response) - if response.status != 200: - return False - data = await response.json() - print(data) - # If key invalid, response will contain "error" - if "error" in data: - return False - return True + async with httpx.AsyncClient(timeout=30) as client: + response = await client.post(url, headers=headers, json=payload) + print(response) + + if response.status_code != 200: + return False + + data = response.json() + print(data) + + # If key invalid, response will contain "error" + if "error" in data: + return False + + return True except Exception: return False