|
@@ -16,22 +16,22 @@ RLT_PASSID = "mmsyjglj_qyllrltdy"
|
|
|
RLT_TOKEN = "f263d7f514724944b665bee64440ffb0"
|
|
|
|
|
|
# 2.行政区划人流量查询接口
|
|
|
-def listPopulationNumberByRegion(regionCode: str = '4407'):
|
|
|
- url = ROOT_PATH + '/qyllrlt/listPopulationNumberByRegion'
|
|
|
+def listPopulationNumberByRegion(regionCode: str = '4409'):
|
|
|
+ url = ROOT_PATH + f'/qyllrlt/listPopulationNumberByRegion?regionCode={regionCode}®ionType=city&dataSource=4'
|
|
|
logger.info('rltapi get: {}', url)
|
|
|
- payload = f"regionCode={regionCode}®ionType=city&dataSource=4"
|
|
|
- return __get_url(url, payload)
|
|
|
+ # payload = f"regionCode={regionCode}®ionType=city&dataSource=4"
|
|
|
+ return __get_url(url)
|
|
|
|
|
|
|
|
|
# 3.行政区划人口热力查询接口
|
|
|
-def listPopulationHeatByRegion(regionCode: str = '4407'):
|
|
|
- url = ROOT_PATH + '/qyllrlt/listPopulationHeatByRegion'
|
|
|
+def listPopulationHeatByRegion(regionCode: str = '4409'):
|
|
|
+ url = ROOT_PATH + f'/qyllrlt/listPopulationHeatByRegion?regionCode={regionCode}®ionType=city&dataSource=4'
|
|
|
logger.info('rltapi get: {}', url)
|
|
|
- payload = f"regionCode={regionCode}®ionType=city&dataSource=4"
|
|
|
- return __get_url(url, payload)
|
|
|
+ # payload = f"regionCode={regionCode}®ionType=city&dataSource=4"
|
|
|
+ return __get_url(url)
|
|
|
|
|
|
-def __get_url(url: str, payload: str):
|
|
|
- print(payload)
|
|
|
+def __get_url(url: str, payload: str=''):
|
|
|
+ # print(payload)
|
|
|
|
|
|
timestamp = str(int(time.time()))
|
|
|
nonce = ranstr(20)
|
|
@@ -42,17 +42,20 @@ def __get_url(url: str, payload: str):
|
|
|
"x-rio-timestamp": timestamp,
|
|
|
"x-rio-nonce": nonce,
|
|
|
"x-rio-paasid": RLT_PASSID,
|
|
|
- "Content-Type": 'application/x-www-form-urlencoded'
|
|
|
+ "Content-Type": 'application/x-www-form-urlencoded',
|
|
|
+ "x-datax-code": "dss-qyrkrlzp",
|
|
|
+ "x-datax-passid": "qyllrlt"
|
|
|
}
|
|
|
print(headers)
|
|
|
|
|
|
urllib3.disable_warnings()
|
|
|
response = requests.get(url, headers=headers, data=payload, verify=False)
|
|
|
if response.status_code == 200:
|
|
|
+ logger.info('rltapi return: {}', response.text)
|
|
|
result = response.json()
|
|
|
- if result['code'] == 0:
|
|
|
+ if result['status'] == 0:
|
|
|
return result['data']
|
|
|
- return AppException(result['code'], result['message'])
|
|
|
+ return AppException(result['status'], result['msg'])
|
|
|
|
|
|
else:
|
|
|
logger.info('rltapi return: {}, {}', response.status_code, response.text)
|