Skip to content

Instantly share code, notes, and snippets.

@abdo1819
Created January 31, 2020 23:49
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 abdo1819/79965165332e45b18bf0bd08d8c8ff78 to your computer and use it in GitHub Desktop.
Save abdo1819/79965165332e45b18bf0bd08d8c8ff78 to your computer and use it in GitHub Desktop.
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