Open saizk opened 1 year ago
I have solved the issue by modifying the method places_photo()
as follows:
params = {"photoreference": photo_reference, "key": client.key}
if max_width:
params["maxwidth"] = max_width
if max_height:
params["maxheight"] = max_height
async with client.aiohttp_session as session:
async with session.get('https://maps.googleapis.com/maps/api/place/photo', params=params) as resp:
if resp.status != 200:
raise ValueError(f"Unable to download image, status code: {resp.status}")
image_content = await resp.read()
return image_content
It does not use native method client._request()
but it solves the issue.
After that the image is saved normally:
with open(output_dir, 'wb') as f:
f.write(image)
When calling
places_photo()
method it causes the following error:When the function call is awaited another error appears:
I have modified
places_photo()
as follows:But I got another error with less information:
My Python version is 3.11.0 And my requirements are the following:
I would appreciate if you can help me with this issue. Thank you!