-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathlocustfile.py
More file actions
31 lines (23 loc) · 814 Bytes
/
locustfile.py
File metadata and controls
31 lines (23 loc) · 814 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
import time
import json
import uuid
import hashlib
import random
import string
from locust import HttpUser, task, constant
from locust.contrib.fasthttp import FastHttpUser
CHANNEL_ID = "3439-93605"
class QuickstartUser(FastHttpUser):
wait_time = constant(10000)
def on_start(self):
message = ''.join(random.choices(string.ascii_lowercase, k=10))
payload = {"nickname":"test","id":"test"}
headers = {
"content-type": "application/json",
"X-Api-Public": "1650371027699-nReuxg6MCJ5LEodAIIFcnt9I3CqkcKqb",
"X-Api-Private": "1650371027699-YOfVdxTrDudeLHTtNYb3gMI1g1UuLip4"
}
self.client.post(f'/space/channel/{CHANNEL_ID}/participant', data=json.dumps(payload), headers=headers)
@task
def do_nothing(self):
pass