jumpserver :v3.6.3
def _gen_auth(self):
signature_headers = ["(request-target)", "accept", "date"]
auth = HTTPSignatureAuth(
key_id=self.KeyID,
secret=self.SecretID,
algorithm="hmac-sha256",
headers=signature_headers,
)
return auth
def update_host(self, host: dict, **kwargs):
url = self.jms_url + f"/api/v1/assets/devices/{host['id']}"
host.update(kwargs)
print(self.auth)
response = requests.put(
url,
auth=self.auth,
headers=self.headers,
json=host,
)
response.raise_for_status()
requests.exceptions.HTTPError: 401 Client Error: Unauthorized for url: http://example.com:10086/api/v1/assets/devices/58cf8681-4918-4fa2-9d61-49bbb230ed02/
创建hosts是可行的,但是在更新时出现了权限错误。api key是管理员账号创建的,想知道是什么原因。