Created
January 31, 2020 23:49
-
-
Save abdo1819/79965165332e45b18bf0bd08d8c8ff78 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import requests | |
def get_speed(long,lat): | |
resp = requests.get('http://evilcar.herokuapp.com/speed',{'lat':lat,'long':long}) | |
# 'endingLat', 'endingLong', 'speed' | |
if resp.status_code == 200: | |
dict = resp.json() | |
endingLat = dict['endingLat'] | |
endingLong = dict['endingLong'] | |
speed = dict['speed'] | |
return speed | |
def submit_violation(id,longitude,latitude,speed,time): | |
data = { | |
'id' :id, | |
'longitude' :longitude, | |
'latitude' :latitude, | |
'speed' :speed, | |
'time' :time | |
} | |
r = requests.post('http://evilcar.herokuapp.com/report',json=data) | |
return r.content | |
if __name__ == "__main__": | |
# print(get_speed(1,4)) | |
print(submit_violation(42,1.55,1.2,50,20)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment