Skip to content

Instantly share code, notes, and snippets.

@pointofpresence
Last active March 31, 2024 20:01
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save pointofpresence/e19aac7d7f2419dbcec55025cc96a426 to your computer and use it in GitHub Desktop.
Save pointofpresence/e19aac7d7f2419dbcec55025cc96a426 to your computer and use it in GitHub Desktop.
Python: Запрос JSON методом GET и парсинг
import requests
url = 'http://maps.googleapis.com/maps/api/directions/json'
params = dict(
origin='Chicago,IL',
destination='Los+Angeles,CA',
waypoints='Joplin,MO|Oklahoma+City,OK',
sensor='false'
)
resp = requests.get(url=url, params=params)
data = resp.json() # Check the JSON Response Content documentation below
# JSON Response Content: https://requests.readthedocs.io/en/master/user/quickstart/#json-response-content
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment