I want to use python to grab Google Street View image. For example:
'url=https://maps.googleapis.com/maps/api/streetview?location=48.15763817939112,11.533002555370581&size=512x512&key=
I run the following code:
import requests
result = requests.get(url)
result.json()
But it comes out an error:
Traceback (most recent call last):
File "<ipython-input-69-180c2a4b335d>", line 1, in <module>
result.json()
File "/home/kang/.local/lib/python3.4/site-packages/requests/models.py", line 826, in json
return complexjson.loads(self.text, **kwargs)
File "/home/kang/.local/lib/python3.4/site-packages/simplejson/__init__.py", line 516, in loads
return _default_decoder.decode(s)
File "/home/kang/.local/lib/python3.4/site-packages/simplejson/decoder.py", line 370, in decode
obj, end = self.raw_decode(s)
File "/home/kang/.local/lib/python3.4/site-packages/simplejson/decoder.py", line 400, in raw_decode
return self.scan_once(s, idx=_w(s, idx).end())
JSONDecodeError: Expecting value
The response of this url is:
How to fix that? Thank you very much.
There is no JSON in the response that is coming back to you, which is why it is giving the error.