diff --git a/code/routing.py b/code/routing.py new file mode 100644 index 0000000..2a4ce35 --- /dev/null +++ b/code/routing.py @@ -0,0 +1,20 @@ +import requests + +API_KEY = 'AIzaSyBoBHzeQFgR7O-NlNsuHXQcC1B7ccEHpl8' +url = "https://maps.googleapis.com/maps/api/distancematrix/json" +origin = '51.5636306598907,-0.11061106079085892' +dest = "51.53836609846008,-0.12743940233824352" + +params = { + "origins": origin, + "destinations": dest, + "key": API_KEY, + "departure_time": "", # timstamp, optional + "mode": "transit", +} + +r = requests.get(url, params=params) +print(r.status_code) + +print(r.json()) + diff --git a/code/utils.py b/code/utils.py new file mode 100644 index 0000000..8d605b8 --- /dev/null +++ b/code/utils.py @@ -0,0 +1,9 @@ +from datetime import datetime, timedelta, timezone +def nextMonday(): + now = datetime.now(timezone.utc) + days_until_monday = (0 - now.weekday() + 7) % 7 + monday = now + timedelta(days=days_until_monday) + monday_9am = monday.replace(hour=9, minute=0, second=0, microsecond=0, tzinfo=timezone.utc) + return monday_9am + +print(nextMonday()) \ No newline at end of file