Skip to content

Instantly share code, notes, and snippets.

@thehoneymad
Created May 18, 2016 05:24
Show Gist options
  • Select an option

  • Save thehoneymad/fbb19e14bcf9a82a4569e61fc5e58f9c to your computer and use it in GitHub Desktop.

Select an option

Save thehoneymad/fbb19e14bcf9a82a4569e61fc5e58f9c to your computer and use it in GitHub Desktop.
Sample request towards thor for VTS report submission
import requests
import json
url = 'http://thor.gobd.co/vts/ping'
payload = {
'provider' : 'finder',
'data' : [
{
'status' : 'A',
'number' : '123456',
'speed' : 12,
'loc': {
'type': 'Point',
'coordinates' : [90.419571,23.761491]
}
}]
}
headers = {'content-type': 'application/json'}
response = requests.post(url, data=json.dumps(payload), headers=headers)
print response
@mssobhan

mssobhan commented May 18, 2016

Copy link
Copy Markdown
query_args = {
    "provider" : "finder",
    "data" : output[0:10]
}
print query_args
headers = {'content-type': 'application/json'}
#r = requests.post(url,json=query_args,headers=headers)
r = requests.post(url,data=json.dumps(query_args),headers=headers)
print r.content
print r
print r.encoding

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment