Page tree
Skip to end of metadata
Go to start of metadata
#!/usr/bin/env python
# -*- coding: utf-8 -*-
 
import json
import requests
 
 
def main():
    login_url = "http://www.tourrun.net/UrlLogin.aspx"
    payload = {
        "txtUserName": "868120136943260",
        "txtUserPassword": "123456",
        "hidRememberPwd": 0,
        "loginType": 1,
    }
    r = requests.post(login_url, data=payload, allow_redirects=False)
    cookies = r.cookies
 
    tracking_url = "http://www.tourrun.net/Ajax/DevicesAjax.asmx/GetTracking"
    payload = {
        "DeviceID": 593433,
        "TimeZone": "China Standard Time",
    }
    headers = {
        "Content-Type": "application/json",
    }
    r = requests.post(tracking_url, data=json.dumps(payload), headers=headers, cookies=cookies)
    if r.status_code != requests.codes.ok:
        print "get tracking fail, http code:", r.status_code
 
    print r.json()
    # result
    # {u'd': u'{locationID:48,deviceUtcDate:"2016-04-17 16:25:35",serverUtcDate:"2016-04-18 23:16:08",latitude:"23.153504",longitude:"113.346436",baiduLat:"23.159182",baiduLng:"113.352995",oLat:"23.156055",oLng:"113.340978",speed:"0.00",model:65,course:250,isStop:1,stopTime:"1850",dataType:1,icon:1,status:"Stop",dataContext:"0",distance:"0",carStatus:"4",starNumber:0}'}
 
 
 
if __name__ == "__main__":
    main()
  • No labels
Write a comment...