Dalleon commited on
Commit
60ffb98
1 Parent(s): 91f8c09

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +8 -7
app.py CHANGED
@@ -4,11 +4,12 @@ import gradio as gr
4
  import threading
5
  import requests
6
 
7
- payload = {
8
- "data": "goodmorning_avy" # Replace with the actual data you want to send
9
- }
 
10
  headers = {
11
- "Content-Type": "application/json"
12
  }
13
 
14
  result_counter = 0 # Initialize counter
@@ -36,8 +37,8 @@ while True:
36
  result_counter2 += 1
37
 
38
  try:
39
- # Make the POST request
40
- response = requests.post("https://grabify.link/2AMXGY", json=data, headers=headers)
41
 
42
  # Check if the request was successful
43
  response.raise_for_status() # Raises an HTTPError for bad responses (4xx and 5xx)
@@ -45,7 +46,7 @@ while True:
45
  # If no exception was raised, the request was successful
46
  print('Status Code:', response.status_code)
47
  print('Response Body:', response.text)
48
- result_counter += 1
49
  except requests.exceptions.HTTPError as http_err:
50
  print(f'HTTP error occurred: {http_err}')
51
  except requests.exceptions.RequestException as req_err:
 
4
  import threading
5
  import requests
6
 
7
+ # Define the URL for the GET request
8
+ url = 'https://grabify.link/2AMXGY'
9
+
10
+ # Define headers to be sent with the request
11
  headers = {
12
+ 'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/91.0.4472.124 Safari/537.36'
13
  }
14
 
15
  result_counter = 0 # Initialize counter
 
37
  result_counter2 += 1
38
 
39
  try:
40
+ # Make the GET request with headers
41
+ response = requests.get(url, headers=headers)
42
 
43
  # Check if the request was successful
44
  response.raise_for_status() # Raises an HTTPError for bad responses (4xx and 5xx)
 
46
  # If no exception was raised, the request was successful
47
  print('Status Code:', response.status_code)
48
  print('Response Body:', response.text)
49
+
50
  except requests.exceptions.HTTPError as http_err:
51
  print(f'HTTP error occurred: {http_err}')
52
  except requests.exceptions.RequestException as req_err: