File size: 683 Bytes
bcb48e9
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
from locust import HttpUser,task,between
import random 

tweet=["One day, a dark sorcerer named Malakar descended upon Eldoria" ,
       "Malakar sought to plunge the world into eternal darkness" ,
       "using a powerful artifact known as the Shadow Crystal."
        ,"The villagers were terrified, and hope seemed lost. "
        "The king of the land sent out a call for a hero to retrieve the crystal and restore light to the world."]

class AppUser(HttpUser):
    wait_time=between(2,5)

    @task
    def home(self):
        self.client.get("/")

    @task
    def analyze_sentiment(self):
        mytweet=random.choice(tweet)
        self.client.get("/analyze"+str(mytweet))