Skip to content

Instantly share code, notes, and snippets.

@tana9
Created January 15, 2021 12:19
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 tana9/dd3162012734421eec71b4841f62783a to your computer and use it in GitHub Desktop.
Save tana9/dd3162012734421eec71b4841f62783a to your computer and use it in GitHub Desktop.
"""
Google MapsのdirectionsAPIの結果をJSON形式で保存する
"""
import json
import googlemaps
gmaps = googlemaps.Client(key="")
result = googlemaps.client.directions(gmaps, language="ja", mode="driving", origin="東京駅", destination="秋葉原駅")
print(result)
with open("directions.json", "w", encoding="utf8") as f:
json.dump(result, f, ensure_ascii=False, indent=2)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment