chore: 行尾统一为 LF
- 新增 .gitattributes:* text=auto eol=lf,二进制类型显式标 binary - 24 个 CRLF 文件归一为 LF(内容零变化,忽略行尾后 diff 只有本文件与 .gitignore) - .gitignore 补 temp/、.pytest_cache/、token_config.txt.old-bak、scripts/.pack_baseline.json 等
This commit is contained in:
+43
-43
@@ -1,43 +1,43 @@
|
||||
#!/usr/bin/env python3
|
||||
# -*- coding: utf-8 -*-
|
||||
"""测试API坐标"""
|
||||
|
||||
import requests
|
||||
import json
|
||||
import time
|
||||
import hashlib
|
||||
import urllib3
|
||||
urllib3.disable_warnings(urllib3.exceptions.InsecureRequestWarning)
|
||||
|
||||
HEADERS = {
|
||||
'Host': 'bike.sdlongren.com',
|
||||
'hsf-x-tokenid': '1291378',
|
||||
'xweb_xhr': '1',
|
||||
'platform': 'xiaobai',
|
||||
'user-agent': 'Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/107.0.0.0 Safari/537.36 MicroMessenger/7.0.20.1781(0x6700143B) NetType/WIFI MiniProgramEnv/Windows WindowsWechat/WMPF WindowsWechat(0x63090c38)XWEB/8518',
|
||||
'content-type': 'application/json',
|
||||
'accept': '*/*',
|
||||
'referer': 'https://servicewechat.com/wx10426ca961518f43/98/page-frame.html',
|
||||
}
|
||||
|
||||
ts = str(int(time.time()))
|
||||
raw = f"1291378GET/project/map{ts}"
|
||||
sig = hashlib.sha256(raw.encode()).hexdigest()[:40]
|
||||
HEADERS['hsf-x-timestamp'] = ts
|
||||
HEADERS['hsf-x-signature'] = sig
|
||||
|
||||
resp = requests.get('https://bike.sdlongren.com/project/map?type=3', headers=HEADERS, verify=False)
|
||||
data = resp.json()
|
||||
|
||||
# 打印返回的学校中心坐标和前3辆车的坐标
|
||||
if data.get('rtn_code') == 0 and data.get('data'):
|
||||
d = data['data']
|
||||
print('=== 学校中心坐标 ===')
|
||||
print(f'centerLatitude: {d.get("centerLatitude")}')
|
||||
print(f'centerLongitude: {d.get("centerLongitude")}')
|
||||
print()
|
||||
print('=== 前3辆车坐标 ===')
|
||||
for i, bike in enumerate(d.get('bicycleStation', [])[:3]):
|
||||
print(f'{i+1}. code={bike.get("code")}, lat={bike.get("latitude")}, lng={bike.get("longitude")}')
|
||||
else:
|
||||
print('请求失败:', data)
|
||||
#!/usr/bin/env python3
|
||||
# -*- coding: utf-8 -*-
|
||||
"""测试API坐标"""
|
||||
|
||||
import requests
|
||||
import json
|
||||
import time
|
||||
import hashlib
|
||||
import urllib3
|
||||
urllib3.disable_warnings(urllib3.exceptions.InsecureRequestWarning)
|
||||
|
||||
HEADERS = {
|
||||
'Host': 'bike.sdlongren.com',
|
||||
'hsf-x-tokenid': '1291378',
|
||||
'xweb_xhr': '1',
|
||||
'platform': 'xiaobai',
|
||||
'user-agent': 'Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/107.0.0.0 Safari/537.36 MicroMessenger/7.0.20.1781(0x6700143B) NetType/WIFI MiniProgramEnv/Windows WindowsWechat/WMPF WindowsWechat(0x63090c38)XWEB/8518',
|
||||
'content-type': 'application/json',
|
||||
'accept': '*/*',
|
||||
'referer': 'https://servicewechat.com/wx10426ca961518f43/98/page-frame.html',
|
||||
}
|
||||
|
||||
ts = str(int(time.time()))
|
||||
raw = f"1291378GET/project/map{ts}"
|
||||
sig = hashlib.sha256(raw.encode()).hexdigest()[:40]
|
||||
HEADERS['hsf-x-timestamp'] = ts
|
||||
HEADERS['hsf-x-signature'] = sig
|
||||
|
||||
resp = requests.get('https://bike.sdlongren.com/project/map?type=3', headers=HEADERS, verify=False)
|
||||
data = resp.json()
|
||||
|
||||
# 打印返回的学校中心坐标和前3辆车的坐标
|
||||
if data.get('rtn_code') == 0 and data.get('data'):
|
||||
d = data['data']
|
||||
print('=== 学校中心坐标 ===')
|
||||
print(f'centerLatitude: {d.get("centerLatitude")}')
|
||||
print(f'centerLongitude: {d.get("centerLongitude")}')
|
||||
print()
|
||||
print('=== 前3辆车坐标 ===')
|
||||
for i, bike in enumerate(d.get('bicycleStation', [])[:3]):
|
||||
print(f'{i+1}. code={bike.get("code")}, lat={bike.get("latitude")}, lng={bike.get("longitude")}')
|
||||
else:
|
||||
print('请求失败:', data)
|
||||
|
||||
Reference in New Issue
Block a user