(20250825) -Added debug print statement for google places api testing.
This commit is contained in:
@@ -182,10 +182,12 @@ class PlacesController(GooglePlacesController):
|
||||
|
||||
try:
|
||||
async with aiohttp.ClientSession() as session:
|
||||
async with session.post(url, headers=headers, json=payload, timeout=10) as response:
|
||||
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
|
||||
@@ -204,6 +206,8 @@ class PlacesController(GooglePlacesController):
|
||||
|
||||
# CHECK -- API KEY IS VALID -
|
||||
valid_api = await PlacesController.is_google_places_api_key_valid(api_key=auth.apiKey)
|
||||
print(valid_api)
|
||||
|
||||
if valid_api:
|
||||
success, object_id = await self.set_token_direct_with_return_id(
|
||||
sql_conn=sql_conn,
|
||||
@@ -229,6 +233,7 @@ class PlacesController(GooglePlacesController):
|
||||
display_picture=None,
|
||||
session_token=session_token
|
||||
)
|
||||
print(success)
|
||||
|
||||
# Done here:
|
||||
return PlacesAuthResponse(
|
||||
@@ -531,4 +536,10 @@ class PlacesController(GooglePlacesController):
|
||||
|
||||
if __name__ == "__main__":
|
||||
|
||||
pass
|
||||
async def main():
|
||||
# CHECK -- API KEY IS VALID -
|
||||
valid_api = await PlacesController.is_google_places_api_key_valid(api_key="AIzaSyBsrZ-FtcNVnnZu0V-MpcyncsmMc69zSVY")
|
||||
print(valid_api)
|
||||
|
||||
|
||||
asyncio.run(main())
|
||||
|
||||
Reference in New Issue
Block a user