紫微设置定时任务

# -*- coding: utf-8 -*-
#!/bin/python




import requests,json
import time
import threading


address = 'https://sitcloud.test.webank.com/we'
i = 0

def record_birthday_seat(name, seat, birthday):
global i
i += 1
payload = {'user':name, 'seat':seat, 'birthday':birthday}
response = requests.post('%s/record_birthday_seat'%address, data=json.dumps(payload))
print(time.strftime("%Y-%m-%d %H:%M:%S") +' : response 第' + str(i) + '次')
print(response.text)
t = threading.Timer(1, record_birthday_seat, ('wezwsong', 's22668', '2019-06-24'))#设置定时任务
t.start()


if __name__ == "__main__":
record_birthday_seat('wezwsong', 's22668', '2019-06-24')

猜你喜欢

转载自www.cnblogs.com/zhaobobo10/p/11095056.html