1234567891011121314151617181920212223242526272829303132333435 |
- from Utils.DingTalk import *
- from Utils.Hik import *
- import datetime
- import os
- def datetime_now():
- datetime_now = datetime.datetime.now().strftime("%Y-%m-%d")
- return datetime_now
- def endDate():
- endDate = int(datetime.datetime.now().strftime("%Y")) +10
- endDate = str(endDate) +"-01-01"
- return endDate
- with open("config.json","r") as f:
- data = json.load(f)
- mobile = data["mobile"]
- appkey = "dinglmkgry6mibab7tgs"
- appsecret = "DiJEEMHDt7Mk9X1eb_oFT4Vh-OIeRqN36HtIAbxD8M5Q6VGUvgsfzGRayRkpWO1t"
- # mobile = "15727360513"
- Ding_Talk = DingTalk(appkey, appsecret, mobile)
- userid = Ding_Talk.getuserid_bymobile()
- username = Ding_Talk.username(userid)
- if username:
- host = "https://192.168.64.44:443"
- appKey = "25227103"
- appSecret = "LMGm1LNhAE7zF6Alzqdz"
- Hik_iSecure = Hik_iSecure(host, appKey, appSecret)
- add_user = Hik_iSecure.add_user(username, userid)
- if add_user == "success":
- Hik_iSecure.create_card(datetime_now(),endDate(),userid)
- os.system("pause")
|