Dooratre commited on
Commit
b2d32df
·
verified ·
1 Parent(s): 66fa0b2

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +38 -40
app.py CHANGED
@@ -1,52 +1,50 @@
1
  import requests
2
- import json
3
 
 
4
  url = "https://api.puter.com/signup"
5
 
6
- # Headers (removed problematic ones like `Cookie`, `Sec-*`)
7
  headers = {
8
- "Accept-Language": "en-US,en;q=0.9",
9
- "X-Requested-With": "XMLHttpRequest",
10
- "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",
11
- "Accept": "*/*",
12
- "Content-Type": "application/json",
13
- "Origin": "https://puter.com",
14
- "Referer": "https://puter.com/",
15
- "Connection": "keep-alive"
 
 
 
 
 
 
 
 
 
16
  }
17
 
18
- # Data payload
19
- data = {
20
- "username": "omarnwrxxxxxegee",
21
- "email": "ehsavigegsxxxea@gmail.com",
22
- "password": "1QAZ2wsx34$",
23
  "send_confirmation_code": True,
24
  "p102xyzname": ""
25
  }
26
 
27
- try:
28
- # Make the POST request
29
- response = requests.post(url, headers=headers, json=data)
30
 
31
- # Check if the response status code indicates success (200-299)
32
- if response.ok:
33
- try:
34
- # Attempt to parse the response as JSON
35
- json_response = response.json()
36
- print(f"Status Code: {response.status_code}")
37
- print("Response (JSON):")
38
- print(json.dumps(json_response, indent=4)) # Pretty-print JSON
39
- except ValueError:
40
- # Fallback if the response is not JSON
41
- print(f"Status Code: {response.status_code}")
42
- print("Response (Non-JSON):")
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}")