-
Notifications
You must be signed in to change notification settings - Fork 0
"places_photo" method does not seem to work #1
Copy link
Copy link
Open
Description
When calling places_photo() method it causes the following error:
with open('test.jpg', 'wb') as f:
for chunk in gmaps.places_photo(photo_reference, max_width=100):
if chunk:
f.write(chunk)
TypeError: 'coroutine' object is not iterable
Unclosed client session
client_session: <aiohttp.client.ClientSession object at 0x000001DEA4C4E310>When the function call is awaited another error appears:
with open('test.jpg', 'wb') as f:
for chunk in await gmaps.places_photo(photo_reference, max_width=100):
if chunk:
f.write(chunk)
async_googlemaps.exceptions.TransportError: ClientSession._request() got an unexpected keyword argument 'stream'
Unclosed client session
client_session: <aiohttp.client.ClientSession object at 0x000001BD48A1E290>I have modified places_photo() as follows:
...
response = await client._request(
"/maps/api/place/photo",
params,
extract_body=lambda response: response,
aiohttp_kwargs={"chunked": True}, # aiohttp_kwargs={"stream": True},
)
return response.content.iter_chunks() # return response.iter_content()But I got another error with less information:
aiohttp.client_exceptions.ClientConnectionError: Connection closed
Unclosed client session
client_session: <aiohttp.client.ClientSession object at 0x000001C576452950>
Unclosed connector
connections: ['[(<aiohttp.client_proto.ResponseHandler object at 0x000001C576433C40>, 226194.703)]']
connector: <aiohttp.connector.TCPConnector object at 0x000001C576452990>My Python version is 3.11.0
And my requirements are the following:
aiohttp 3.8.4
aiosignal 1.3.1
async-timeout 4.0.2
attrs 23.1.0
certifi 2023.5.7
charset-normalizer 3.1.0
frozenlist 1.3.3
googlemaps 4.10.0
idna 3.4
multidict 6.0.4
pip 21.3.1
requests 2.31.0
setuptools 60.2.0
urllib3 2.0.3
wheel 0.37.1
yarl 1.9.2
I would appreciate if you can help me with this issue. Thank you!
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels