diff --git a/website/Speedshow_Map.py b/website/Speedshow_Map.py index dd96aaa..325ebe1 100644 --- a/website/Speedshow_Map.py +++ b/website/Speedshow_Map.py @@ -1,14 +1,18 @@ import folium import requests import json +import subprocess -#import scooter data +#make api request + +out1 = subprocess.Popen(["curl", "https://platform.tier-services.io/v1/vehicle/f6f55778-9339-4f81-8584-7645f3a6c4be", "-H", "x-api-key: bpEUTJEBTf74oGRWxaIcW7aeZMzDDODe1yBoSxi2"], stdout=subprocess.PIPE, stderr=subprocess.STDOUT) +stdout, stderr = out1.communicate() +request_scooter1 = stdout -with open('1scooter.json') as file: - data = json.load(file) +#import scooter data -lat = data['data']['attributes']['lat'] -lng = data['data']['attributes']['lng'] +lat = request_scooter1['data']['attributes']['lat'] +lng = request_scooter1['data']['attributes']['lng'] #create map object m = folium.Map(location=[52.516190, 13.377693], zoom_start=13) diff --git a/website/apirequests.py b/website/apirequests.py index d607543..cfa90e0 100644 --- a/website/apirequests.py +++ b/website/apirequests.py @@ -1,7 +1,6 @@ import requests +import subprocess -r = requests.get('https://platform.tier-services.io') - -f6f55778-9339-4f81-8584-7645f3a6c4be - -curl "https://platform.tier-services.io/v2/vehicle/f6f55778-9339-4f81-8584-7645f3a6c4be" -H "x-api-key: bpEUTJEBTf74oGRWxaIcW7aeZMzDDODe1yBoSxi2" \ No newline at end of file +out1 = subprocess.Popen(["curl", "https://platform.tier-services.io/v1/vehicle/f6f55778-9339-4f81-8584-7645f3a6c4be", "-H", "x-api-key: bpEUTJEBTf74oGRWxaIcW7aeZMzDDODe1yBoSxi2"], stdout=subprocess.PIPE, stderr=subprocess.STDOUT) +stdout, stderr = out1.communicate() +print(stdout(['43data'])) \ No newline at end of file diff --git a/website/map.html b/website/map.html index f2369f3..3f3e128 100644 --- a/website/map.html +++ b/website/map.html @@ -23,7 +23,7 @@