Skip to content

Instantly share code, notes, and snippets.

@jpmens
Created April 19, 2021 14:26
Show Gist options
  • Select an option

  • Save jpmens/3e7873d3bf3a73b31174c41431af2b6a to your computer and use it in GitHub Desktop.

Select an option

Save jpmens/3e7873d3bf3a73b31174c41431af2b6a to your computer and use it in GitHub Desktop.
traccar-paris
#!/usr/bin/env python
import requests
import json
import time
data = {
'_type' : 'location',
'lat' : 48.85593,
'lon' : 2.29431,
'tid' : "owntracks/qtripp/j001", # "JJ",
'vel' : 109,
'alt' : 143,
'tst' : int(time.time()),
}
payload = json.dumps(data)
print(payload)
s = requests.Session()
# s.auth = ( 'user', 'pass' )
s.headers.update({
"Content-type" : "application/json"
})
r = s.post("http://127.0.0.1:5144/", data=payload)
print(r.content)
# time.sleep(5)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment