-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathrequest2.py
More file actions
24 lines (19 loc) · 746 Bytes
/
request2.py
File metadata and controls
24 lines (19 loc) · 746 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
import requests
import json
# Define the URL to send the POST request to
url = "http://127.0.0.1:5001/"
# Define the data to be sent in the request body
data = {"md5": "","token":"fUjXn2r5u8x!A%D*"}
# Convert the data to a JSON string
json_data = json.dumps(data)
# Set the headers to indicate that we are sending JSON data
headers = {"Content-Type": "application/json"}
# Send a POST request to the specified URL with the data
response = requests.post(url, data=json_data,headers=headers)
# Check if the request was successful (status code 200)
if response.status_code == 200:
# Print the response content (JSON of the response)
print(response.text)
else:
# Print the error status code
print("Error: ", response.status_code)