test.py 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. # import requests
  2. # import time
  3. # import hashlib
  4. #
  5. # def querySubjectPaperStruct(examid):
  6. # url="http://ecs-dev.qmth.com.cn/api/exchange/outer/question/getSubjectivePaper"
  7. # headers=createRpcheader("0","11")
  8. # data={'des': 'string', 'examId': 2, 'size': 10, 'startId': 1, 'subjectCode': 'ldyCos001'}
  9. # result=requests.post(url,headers=headers,json=data)
  10. # import json
  11. # with open("2.json", "w", encoding="utf-8") as file:
  12. # json_str = json.dumps(result.json(), indent=4, ensure_ascii=False)
  13. # file.write(json_str)
  14. # print(result.json())
  15. #
  16. #
  17. #
  18. # def createRpcheader(rootOrgId,appid):
  19. # secretkey = "123456"
  20. # t = time.time()
  21. # secretstr = ''.join([rootOrgId, appid, str(int(round(t * 1000))), secretkey])
  22. # accssToken = hashlib.sha256(secretstr.encode("utf-8")).hexdigest()
  23. # headers = {
  24. # "appId": appid,
  25. # "rootOrgId": rootOrgId,
  26. # "Access-Token": accssToken,
  27. # "timestamp": str(int(round(t * 1000)))
  28. # }
  29. # return headers
  30. # def querySubjectiveQuestion(examid,subjectcode,startid):
  31. # data={
  32. # "des": "string",
  33. # "examId": examid,
  34. # "size": 2,
  35. # "startId": startid,
  36. # "subjectCode": subjectcode
  37. # }
  38. # print(data)
  39. # url="http://ecs-test.qmth.com.cn:8007/api/exchange/outer/question/getSubjectiveQuestion"
  40. # headers = createRpcheader("17128", "11")
  41. # result = requests.post(url, headers=headers, json=data)
  42. # import json
  43. # with open("1.json", "w", encoding="utf-8") as file:
  44. # json_str = json.dumps(result.json(), indent=4, ensure_ascii=False)
  45. # file.write(json_str)
  46. # print(result.json())
  47. # #print(len(result.json()["dataList"]))
  48. # querySubjectPaperStruct(1)
  49. # # querySubjectPaperStruct(68)
  50. #
  51. import requests
  52. result=requests.get("http://192.168.10.80:9000/card/17/km03.json",verify=False)
  53. with open("2.json","wb") as file:
  54. file.write(result.content)