python-华三防火墙过期策略统计
import requests
import re
import datetime,time
headers_1 = {
"Accept-Encoding": "gzip,deflate",
"Authorization": "Basic 密码隐藏",
"Content-Type": "application/json",
"User-Agent": "Apache-HttpClient/4.1.1 (java 1.5)",
}
url = "http://ip/api/v1/tokens"
req = requests.post(url, headers=headers_1)
token_kye_dictV = req.json().get('token-id')
headers_2 = {
"Accept-Encoding": "gzip,deflate",
"X-Auth-Token": token_kye_dictV, # 请求中需要在请求中携带返回的token-id,放在 X-Auth
共有 0 条评论