# coding: utf-8
import urllib.request
from urllib import error, request
import json
import requests
import socket
import ssl
import time
import hashlib
import hmac,base64
import urllib3
import configparser
import datetime
urllib3.disable_warnings()
print ('--------------------------------------------------------------------------')
cf = configparser.ConfigParser()
def sign(key, value): #根据海康官方公式=BASE64(HmacSHA256(appSecret,"UTF-8"(httpHeaders + customHeaders + url))
temp = hmac.new(key.encode(), value.encode(), digestmod=hashlib.sha256)
return (base64.b64encode(temp.digest()).decode())
t_new= time.strftime('%Y-%m-%dT%H:%M:%S+08:00',time.localtime(time.time())) #最新时间
cf.read("wailaizhu.ini")
appKey = cf.get("desk", "appKey")
appSecret = cf.get("desk", "appSecret")
t_start = cf.get("top", "startTime")
event_T= cf.get("desk", "event_T")
mysqlcon= cf.get("desk", "mysqlcon")
mysqluser= cf.get("desk", "mysqluser")
mysqlpass= cf.get("desk",