|
@@ -0,0 +1,31 @@
|
|
|
+
|
|
|
+import time
|
|
|
+import requests
|
|
|
+
|
|
|
+import threading
|
|
|
+
|
|
|
+
|
|
|
+def http_get(url):
|
|
|
+ response = requests.get(url)
|
|
|
+ resp = response.text
|
|
|
+ print(f"Response: {len(resp)}")
|
|
|
+
|
|
|
+
|
|
|
+def test():
|
|
|
+ print('This is a test function in test.py')
|
|
|
+
|
|
|
+ url = "https://yixue.cxhy.cn/api/test2"
|
|
|
+
|
|
|
+ while True:
|
|
|
+ for i in range(100):
|
|
|
+ t = threading.Thread(target=http_get, args=(url,))
|
|
|
+ t.setDaemon(True)
|
|
|
+ t.start()
|
|
|
+ print(f"Thread {i} started")
|
|
|
+ # r = http_get(url)
|
|
|
+ # print(len(r))
|
|
|
+ time.sleep(3)
|
|
|
+
|
|
|
+
|
|
|
+if __name__ == '__main__':
|
|
|
+ test()
|