12345678910111213141516171819 |
- import requests
- from Utils.HikAccessToken import hik_access_token
- def hik_is_token(hik_accesstoken,client_id,client_secret):
- response = requests.get(
- url="https://api2.hik-cloud.com/api/v1/open/basic/persons/list?access_token=%s&pageNo=1&pageSize=1" % (
- hik_accesstoken)
- )
- response = response.json()
- if response["code"] == 401:
- print("hik token失效,重新获取token")
- hik_accesstoken = hik_access_token(client_id,client_secret)
- return hik_accesstoken
- return hik_accesstoken
|