123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354 |
- # import requests
- # import time
- # import hashlib
- #
- # def querySubjectPaperStruct(examid):
- # url="http://ecs-dev.qmth.com.cn/api/exchange/outer/question/getSubjectivePaper"
- # headers=createRpcheader("0","11")
- # data={'des': 'string', 'examId': 2, 'size': 10, 'startId': 1, 'subjectCode': 'ldyCos001'}
- # result=requests.post(url,headers=headers,json=data)
- # import json
- # with open("2.json", "w", encoding="utf-8") as file:
- # json_str = json.dumps(result.json(), indent=4, ensure_ascii=False)
- # file.write(json_str)
- # print(result.json())
- #
- #
- #
- # def createRpcheader(rootOrgId,appid):
- # secretkey = "123456"
- # t = time.time()
- # secretstr = ''.join([rootOrgId, appid, str(int(round(t * 1000))), secretkey])
- # accssToken = hashlib.sha256(secretstr.encode("utf-8")).hexdigest()
- # headers = {
- # "appId": appid,
- # "rootOrgId": rootOrgId,
- # "Access-Token": accssToken,
- # "timestamp": str(int(round(t * 1000)))
- # }
- # return headers
- # def querySubjectiveQuestion(examid,subjectcode,startid):
- # data={
- # "des": "string",
- # "examId": examid,
- # "size": 2,
- # "startId": startid,
- # "subjectCode": subjectcode
- # }
- # print(data)
- # url="http://ecs-test.qmth.com.cn:8007/api/exchange/outer/question/getSubjectiveQuestion"
- # headers = createRpcheader("17128", "11")
- # result = requests.post(url, headers=headers, json=data)
- # import json
- # with open("1.json", "w", encoding="utf-8") as file:
- # json_str = json.dumps(result.json(), indent=4, ensure_ascii=False)
- # file.write(json_str)
- # print(result.json())
- # #print(len(result.json()["dataList"]))
- # querySubjectPaperStruct(1)
- # # querySubjectPaperStruct(68)
- #
- import requests
- result=requests.get("http://192.168.10.80:9000/card/17/km03.json",verify=False)
- with open("2.json","wb") as file:
- file.write(result.content)
|