|
@@ -32,14 +32,17 @@ class APIMgr():
|
|
|
print(response.content.decode('utf8'))
|
|
|
print('----- https response end-----\n\n')
|
|
|
|
|
|
+
|
|
|
headers = {
|
|
|
+
|
|
|
"user-agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/114.0.0.0 Safari/537.36 Edg/114.0.1823.67"
|
|
|
}
|
|
|
#headers设置为全局变量
|
|
|
+
|
|
|
GSTORE['headers'] = headers
|
|
|
|
|
|
#登录接口
|
|
|
- def mgr_login(self, phone='15225181827', password='123456',useproxies=False):
|
|
|
+ def mgr_login(self, phone='19937989931', password='123456',useproxies=False):
|
|
|
headers=GSTORE['headers']
|
|
|
self.s = requests.Session()
|
|
|
if useproxies:
|
|
@@ -54,9 +57,11 @@ class APIMgr():
|
|
|
self.printResponse(response)
|
|
|
# 把response对象返回出去
|
|
|
return response
|
|
|
-
|
|
|
+ #招标搜索
|
|
|
def search(self, keywords="建筑", publishtime="fiveyear", selectType="content"):
|
|
|
+ #使用全局变量
|
|
|
headers = GSTORE['headers']
|
|
|
+ #保存session
|
|
|
session = self.s
|
|
|
response = session.post(f"{cfg.target_host}/jylab/supsearch/index.html", headers=headers, data={
|
|
|
'keywords': keywords,
|
|
@@ -65,7 +70,44 @@ class APIMgr():
|
|
|
})
|
|
|
self.printResponse(response)
|
|
|
return response
|
|
|
- #函数
|
|
|
+
|
|
|
+ # 企业搜索
|
|
|
+
|
|
|
+ def enterpriseSearch(self, match="北京剑鱼信息技术有限公司河南分公司", matchType="A", pageSize="10", pageNum="0"):
|
|
|
+ # 使用全局变量
|
|
|
+ headers = GSTORE['headers']
|
|
|
+ # 保存session
|
|
|
+ session = self.s
|
|
|
+ response = session.post("https://www.jianyu360.cn/publicapply/enterpriseSearch/doQuery", headers=headers, data={
|
|
|
+ 'match': match,
|
|
|
+ 'matchType': matchType,
|
|
|
+ 'pageSize': pageSize,
|
|
|
+ 'pageNum': pageNum
|
|
|
+ })
|
|
|
+ self.printResponse(response)
|
|
|
+ return response
|
|
|
+
|
|
|
+ # 供应搜索
|
|
|
+ def supplySearch(self, keywords="PH计", searchType="title", province="", city="", time="", status="0",
|
|
|
+ pageSize=50, pageIndex=1):
|
|
|
+ headers = GSTORE['headers']
|
|
|
+ headers['Content-Type'] = 'application/json' # 添加Content-Type头部
|
|
|
+ url = "https://www.jianyu360.cn/jyinfo/supplySearch"
|
|
|
+ data = {
|
|
|
+ "keywords": keywords,
|
|
|
+ "searchType": searchType,
|
|
|
+ "province": province,
|
|
|
+ "city": city,
|
|
|
+ "time": time,
|
|
|
+ "status": status,
|
|
|
+ "pageSize": pageSize,
|
|
|
+ "pageIndex": pageIndex
|
|
|
+ }
|
|
|
+ response = requests.post(url=url, headers=headers, data=json.dumps(data))
|
|
|
+ self.printResponse(response)
|
|
|
+ return response
|
|
|
+
|
|
|
+
|
|
|
apimgr = APIMgr()
|
|
|
|
|
|
|