Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -1,52 +1,50 @@
|
|
1 |
import requests
|
2 |
-
import json
|
3 |
|
|
|
4 |
url = "https://api.puter.com/signup"
|
5 |
|
6 |
-
#
|
7 |
headers = {
|
8 |
-
"
|
9 |
-
"
|
10 |
-
"
|
11 |
-
"
|
12 |
-
"
|
13 |
-
"
|
14 |
-
"
|
15 |
-
"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
16 |
}
|
17 |
|
18 |
-
#
|
19 |
-
|
20 |
-
"username": "
|
21 |
-
"email": "
|
22 |
-
"password": "
|
23 |
"send_confirmation_code": True,
|
24 |
"p102xyzname": ""
|
25 |
}
|
26 |
|
27 |
-
|
28 |
-
|
29 |
-
response = requests.post(url, headers=headers, json=data)
|
30 |
|
31 |
-
|
32 |
-
|
33 |
-
|
34 |
-
|
35 |
-
|
36 |
-
|
37 |
-
|
38 |
-
|
39 |
-
|
40 |
-
|
41 |
-
|
42 |
-
|
43 |
-
print(response.text)
|
44 |
-
else:
|
45 |
-
# Handle non-successful HTTP status codes
|
46 |
-
print(f"HTTP Error! Status Code: {response.status_code}")
|
47 |
-
print("Response:")
|
48 |
-
print(response.text)
|
49 |
-
|
50 |
-
except requests.exceptions.RequestException as e:
|
51 |
-
# Handle network-related errors (e.g., connection issues)
|
52 |
-
print(f"Request failed: {e}")
|
|
|
1 |
import requests
|
|
|
2 |
|
3 |
+
# Define the API URL
|
4 |
url = "https://api.puter.com/signup"
|
5 |
|
6 |
+
# Define the headers (including all the details you provided)
|
7 |
headers = {
|
8 |
+
"accept": "*/*",
|
9 |
+
"accept-encoding": "gzip, deflate, br, zstd",
|
10 |
+
"accept-language": "en-US,en;q=0.9",
|
11 |
+
"connection": "keep-alive",
|
12 |
+
"content-length": "130", # This will be automatically calculated by `requests`
|
13 |
+
"content-type": "application/json",
|
14 |
+
"host": "api.puter.com",
|
15 |
+
"origin": "https://dooratre-yjytjyjtyjtyjtjytj.static.hf.space",
|
16 |
+
"referer": "https://dooratre-yjytjyjtyjtyjtjytj.static.hf.space/",
|
17 |
+
"sec-ch-ua": '"Chromium";v="134", "Not:A-Brand";v="24", "Google Chrome";v="134"',
|
18 |
+
"sec-ch-ua-mobile": "?0",
|
19 |
+
"sec-ch-ua-platform": '"Windows"',
|
20 |
+
"sec-fetch-dest": "empty",
|
21 |
+
"sec-fetch-mode": "cors",
|
22 |
+
"sec-fetch-site": "cross-site",
|
23 |
+
"user-agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/134.0.0.0 Safari/537.36",
|
24 |
+
"x-requested-with": "XMLHttpRequest"
|
25 |
}
|
26 |
|
27 |
+
# Define the payload (request body)
|
28 |
+
payload = {
|
29 |
+
"username": "tdpf6hhhhhtrgrtghhhhhhhQtGu9g",
|
30 |
+
"email": "ehsavregergtgrisea@gmail.com",
|
31 |
+
"password": "jH%K7RQz7t4@C",
|
32 |
"send_confirmation_code": True,
|
33 |
"p102xyzname": ""
|
34 |
}
|
35 |
|
36 |
+
# Send the POST request
|
37 |
+
response = requests.post(url, headers=headers, json=payload)
|
|
|
38 |
|
39 |
+
# Check if the request was successful (status code 200)
|
40 |
+
if response.status_code == 200:
|
41 |
+
try:
|
42 |
+
# Parse and print the JSON response
|
43 |
+
print("Response JSON:")
|
44 |
+
print(response.json())
|
45 |
+
except ValueError:
|
46 |
+
print("The response is not valid JSON.")
|
47 |
+
else:
|
48 |
+
# Print an error message if the status code is not 200
|
49 |
+
print(f"Request failed with status code: {response.status_code}")
|
50 |
+
print(f"Response text: {response.text}")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|