Commit cc141866 authored by wanli's avatar wanli

🌈 style(): 一些不重要的更新

parent 58053bf3
''' '''
Author: your name Author: your name
Date: 2021-07-22 19:01:41 Date: 2021-07-22 19:01:41
LastEditTime: 2021-07-26 16:51:21 LastEditTime: 2021-07-26 13:05:19
LastEditors: Please set LastEditors LastEditors: Please set LastEditors
Description: In User Settings Edit Description: In User Settings Edit
FilePath: \evm-store\tools\build_out\tests\http_interval.py FilePath: \evm-store\tools\build_out\tests\http_interval.py
''' '''
import json import json
import time import time
import signal
import random import random
import requests import requests
from threading import Timer, Thread from threading import Timer, Thread
thread_list = []
def sig_handler(sig, frame):
try:
global thread_list
for t in thread_list:
t.stop()
t.join()
except Exception as e:
print(e)
exit(0)
def send_request(imei): def send_request(imei):
payload = { payload = {
...@@ -106,7 +94,7 @@ def send_request(imei): ...@@ -106,7 +94,7 @@ def send_request(imei):
'png_file_size': random.randint(0, 10000) 'png_file_size': random.randint(0, 10000)
}) })
r = requests.post("http://localhost:3000/api/v1/evm_store/monitor", data=json.dumps(payload)) r = requests.post("http://store.evmiot.com/api/v1/evm_store/monitor", data=json.dumps(payload))
print(r.status_code) print(r.status_code)
print(r.json()) print(r.json())
...@@ -131,22 +119,14 @@ class myThread(Thread): ...@@ -131,22 +119,14 @@ class myThread(Thread):
if __name__ == "__main__": if __name__ == "__main__":
# send_request() # send_request()
signal.signal(signal.SIGTERM, sig_handler)
signal.signal(signal.SIGINT, sig_handler)
# 创建新线程 # 创建新线程
thread1 = myThread(1, "Thread-1", 1, "352099001761481") thread1 = myThread(1, "Thread-1", 1, "352099001761481")
thread2 = myThread(2, "Thread-2", 2, "866866040000447") thread2 = myThread(2, "Thread-2", 2, "866866040000447")
thread_list.append(thread1)
thread_list.append(thread2)
thread1.setDaemon('True')
thread1.setDaemon('True')
# 开启新线程 # 开启新线程
thread1.start() thread1.start()
thread2.start() thread2.start()
# thread1.join() thread1.join()
# thread2.join() thread2.join()
print("退出主线程") print("退出主线程")
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment