import os
import requests
import json
from Util import Properties

print('########[公务员自助列表]################ * start')

properties = Properties("./global.properties").getProperties()

headers = {'User-Agent': 'Mozilla/5.0 (Windows NT 6.1) AppleWebKit/537.11 (KHTML, like Gecko) Chrome/23.0.1271.64 Safari/537.11',
'Accept': 'text/html;q=0.9,*/*;q=0.8',
'Accept-Charset': 'ISO-8859-1,utf-8;q=0.7,*;q=0.3',
'Accept-Encoding': 'gzip',
'Connection': 'close',
'Referer': None # 注意如果依然不能抓取的话,这里可以设置抓取网站的host
}


print('------------------###【0】###----------------------------')


def data0():
with open('./json/GetWorkKey.json', encoding='utf-8') as json_file:
data = json.load(json_file)
return data


print("***执行接口>>>>>", properties['GetWorkKey'], '\n【请求参数】', data0())
r0 = requests.post(properties['GetWorkKey'],
data=data0(), headers=headers)
r0.encoding = 'utf-8'
print('【响应】', r0.text)


print('-------*****[xxx]-----------END*********-----------------------')
os.system('pause')
posted on 2018-06-28 16:45  天之城  阅读(111)  评论(0编辑  收藏  举报