python-requests请求
#! /usr/bin/env python # -*- coding:utf-8 –*- import json import time import hashlib import requests rid = 'zhoujt_test' user = 'zhoujiangtao' token = 'xxxxxxxxxxxxx' nowtime = int(time.time()) signstr = user + str(nowtime) + rid + token signature = md5hash.hexdigest() headers = { 'User': user, 'Timestamp': str(nowtime), 'cc_request_id': rid, 'Authorization': signature, 'Content-Type': 'application/json' } # 查询 list_url = "xxxxxxxxxxxxx/list/" # 查看data data = {"Job": "linux", "Token": "xxxxxxxxxxxxx"} res = requests.request("POST", url=list_url, data=json.dumps(data), headers=headers) print(res.json())