This might seem like an extremely simple and stupid question yet i can’t find a convenient answer.
I’m trying to use google’s reverse geocodding api with django, as the website explains (at
https://developers.google.com/maps/documentation/geocoding/start?csw=1#ReverseGeocoding) I’m supposed to send a request to the url :
But I can’t find an appropriate way to send this request using django to google api.
To me it seems something so simple will be doable by some method built-in django but all I could find was modules to install.
If there’s no way but installing other python modules which one’s the best?
Well, the most straightforward way would be to install
requests library and simply call:
result = requests.get(your_link)
requests library is very well written, very intuitive and simple to use. Quite a lot of smart people and companies use it, too, so it’s not a half-baked library someone just hacked out over the weekend (as of this moment, it has 6060 commits and 595 contributors on GitHub).
If you absolutely must avoid external libraries, why not try
urllib.request. It’s a bit more complicated, and even the docs themselves recommend using
requests if you prefer higher-level interface. But you definitely can get the job done with it. To get started, you can read the docs on how to use it to fetch data. Read this thread for an example of how to extract json from a response you’d get with
Answered By – cegas