1
This commit is contained in:
parent
ba2c2ee5e7
commit
20bdf59efd
@ -20,17 +20,17 @@ def md5Sign(params, secret, timestamp, connstr = '&', secret_connstr = ':'):
|
||||
m5.update(str1.encode('utf-8'))
|
||||
return m5.hexdigest()
|
||||
except Exception as e:
|
||||
print('md5Sign error: ' + str(e))
|
||||
print('md5Sign error: ' + str(e), flush=True)
|
||||
|
||||
def getDaySeconds(time_val, incdays):
|
||||
time_zone = 8
|
||||
dayseconds = int((time_val + time_zone * 3600)/3600/24 + incdays) * 3600 * 24 - 3600 * time_zone;
|
||||
print(dayseconds)
|
||||
print(dayseconds, flush=True)
|
||||
return dayseconds
|
||||
|
||||
def sendNotify(conf, sendtime):
|
||||
try:
|
||||
print('sendNotify start')
|
||||
print('sendNotify start', flush=True)
|
||||
params = {'key' : 'kingsome'}
|
||||
secret = 'fc38349c5d084e920925e614c420be9f'
|
||||
timestamp = time.time()
|
||||
@ -38,9 +38,9 @@ def sendNotify(conf, sendtime):
|
||||
url = conf['notify_url'] + '×tamp=' + str(timestamp) + '&sign=' + md5signstr
|
||||
req = urllib.request.Request(url)
|
||||
data = urllib.request.urlopen(req).read()
|
||||
print('sendNotify end')
|
||||
print('sendNotify end', flush=True)
|
||||
except Exception as e:
|
||||
print('sendNotifu error: ' + str(e))
|
||||
print('sendNotifu error: ' + str(e), flush=True)
|
||||
|
||||
#进入下一次循环
|
||||
tornado.ioloop.IOLoop.current().call_at(getDaySeconds(time.time(), 1) + sendtime,
|
||||
@ -63,7 +63,7 @@ def make_app():
|
||||
])
|
||||
|
||||
if __name__ == "__main__":
|
||||
print('start!')
|
||||
print('start!', flush=True)
|
||||
conf = json.loads(open('../config/kefu_robot.json', 'r').read())
|
||||
app = make_app()
|
||||
app.listen(conf['listen_port'])
|
||||
|
Loading…
x
Reference in New Issue
Block a user