diff --git a/__pycache__/main.cpython-38.pyc b/__pycache__/main.cpython-38.pyc new file mode 100644 index 0000000000000000000000000000000000000000..186fc847c0b640451552824992fc6e3d71cea443 Binary files /dev/null and b/__pycache__/main.cpython-38.pyc differ diff --git a/main.py b/main.py index 4c0c135f61696bcf42c375ca5ab62aa5b105afc8..d95f2c4ecd74365363519b0e233ba3cadba91958 100644 --- a/main.py +++ b/main.py @@ -1 +1,30 @@ -print('欢迎来到 InsCode') \ No newline at end of file +from locust import HttpUser, TaskSet, task +import urllib3 + + +urllib3.disable_warnings() + + +class UserBehavior(TaskSet): + + def on_start(self): + print("start****") + + def on_stop(self): + print("stop****") + + @task(1) + def baidu_page1(self): + res = self.client.get("/", verify=False) + + +class WebsiteUser(HttpUser): + tasks = [UserBehavior] + host = "https://www.baidu.com" + min_wait = 1000 + max_wait = 2000 + + +if __name__ == '__main__': + import os + os.system("locust -f main.py --host=https://www.baidu.com") \ No newline at end of file