import sys
import imp
import os
import logging
import requests
import json
imp.reload(sys)
os.environ['NLS_LANG'] = 'SIMPLIFIED CHINESE_CHINA.UTF8'
logging.basicConfig(format="%(asctime)s %(message)s", datefmt='%Y-%m-%d %H:%M:%S %a')
url = "https://ip:port/path"
headers = {
'Content-Type': 'application/json;charset=utf-8',
'app-key': '123456',
'staffCode': 'abcdef'
}
data = {
"city": "南京",
"specialty": "*",
"account_num": "[\"025-123456\"]"
}
res = requests.post(url = url, headers = headers, data = json.dumps(data))
res.encoding='utf-8'
ipStr = ''
if "200" = res.status_code:
ips = res.json()['data']['atom_data']['OltProp'].keys()
for ip in ips:
ipStr = ipStr + ip + ' '
print("ipStr:", ipStr)