HikDeletevisitor.py 893 B

12345678910111213141516171819202122232425262728293031
  1. import requests
  2. import json
  3. from Utils.HikAccessToken import hik_access_token
  4. def hik_delete_visitor(hik_accesstoken,expire_visitor):
  5. for employeeNo in expire_visitor:
  6. requests.post(
  7. url="https://api2.hik-cloud.com/api/v1/open/basic/persons/delete?access_token=%s&employeeNo=%s" %(hik_accesstoken,employeeNo)
  8. )
  9. return
  10. # if __name__ == '__main__':
  11. # with open("../config.json") as f:
  12. # data = json.load(f)
  13. # client_id = data["client_id"]
  14. # client_secret = data["client_secret"]
  15. # groupId = data["groupId"]
  16. # expire_visitor = ['visitor202209161700221863039', 'visitor202209161658221423088']
  17. # hik_accesstoken = hik_access_token(client_id, client_secret)
  18. # print("开始删除过期访客信息")
  19. # hik_delete_visitor(hik_accesstoken, expire_visitor)
  20. # print("删除过期访客信息成功")