1234567891011121314 |
- import requests
- def hik_access_token(client_id,client_secret):
- data = {
- "client_id": client_id,
- "client_secret": client_secret,
- "grant_type": "client_credentials"
- }
- headers = {"content-type": "application/x-www-form-urlencoded"}
- response =requests.post(url="https://api2.hik-cloud.com/oauth/token",headers=headers,data=data)
- response_json = response.json()
- hik_access_token = response_json["access_token"]
- return hik_access_token
|