-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtest.py
26 lines (20 loc) · 784 Bytes
/
test.py
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
import requests
endpoint_url = 'http://localhost:8080/'
def interact_with_endpoint():
prompt = input("Enter a prompt (default: Welcome): ") or 'Welcome'
username = input("Enter your username (default: User): ") or 'User'
group_users = input("Enter group users (comma-separated, if any): ").split(',')
params = {
'prompt': prompt,
'username': username,
'group_users': group_users
}
response = requests.get(endpoint_url, params=params)
if response.status_code == 200:
data = response.json()
print(f"Response: {data['response']}")
else:
print(f"Error: Failed to fetch data from server (Status code: {response.status_code})")
if __name__ == '__main__':
while True:
interact_with_endpoint()