Created
May 8, 2019 01:28
-
-
Save pansila/0f8ab4ca16d1f4d7e3d5e2f6a731a611 to your computer and use it in GitHub Desktop.
query bus status of city Suzhou
This file contains 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 | |
import time | |
import math | |
def query_traffic(line): | |
payload = {'Guid': '24fce9ce-f441-45c5-99e1-bc6b40661f1e', | |
'city_id': '320500', | |
'deviceId': 'd049666ff7e010318f0cdc2c75d95ff0', | |
'sign': '539f272911d2bb23117ea6211cce1bb5', | |
'client_id': '320500', | |
'pf': 'android', | |
'lng': '116.403883830277408', | |
'openid': '0', | |
'platform': '2', | |
'device_id': 'd049666ff7e010318f0cdc2c75d95ff0', | |
'client_ver': '5.2.1', | |
'uid': '0', | |
'lat': '39.91552051353662'} | |
payload['ts'] = math.floor(time.time()) | |
r = requests.get('http://content.2500city.com/api18/bus/getLineInfo', params=payload) | |
if r.status_code == 200: | |
if r.json()['errorCode'] == 0: | |
for s in r.json()['data']['StandInfo']: | |
if s['SCode'] == 'JPW': | |
print(s) | |
if __name__ == '__main__': | |
query_traffic(116) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment