Dalleon commited on
Commit
68ebe08
1 Parent(s): 92d78d7

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +16 -5
app.py CHANGED
@@ -3,12 +3,14 @@ import time
3
  import gradio as gr
4
  import threading
5
  import requests
 
 
6
 
7
  url_list = [
8
- "https://spiny-upbeat-lingonberry.glitch.me/",
9
- "https://wooded-near-science.glitch.me/",
10
- "https://airzy.glitch.me/api",
11
- "https://bubble-magnificent-bicycle.glitch.me/api/wake"
12
  ]
13
 
14
  payload = {
@@ -43,8 +45,17 @@ while True:
43
  result_counter2 += 1
44
  for url in url_list:
45
  try:
46
- requests.post(url, json=payload, headers=headers)
 
 
 
 
 
 
47
  response.raise_for_status() # Raise an error for bad status codes
 
 
 
48
  result_counter += 1
49
  except requests.exceptions.RequestException as e:
50
  print(f"Error ({url}):", str(e))
 
3
  import gradio as gr
4
  import threading
5
  import requests
6
+ import socket
7
+
8
 
9
  url_list = [
10
+ "spiny-upbeat-lingonberry.glitch.me",
11
+ "hwooded-near-science.glitch.me",
12
+ "airzy.glitch.me",
13
+ "bubble-magnificent-bicycle.glitch.me"
14
  ]
15
 
16
  payload = {
 
45
  result_counter2 += 1
46
  for url in url_list:
47
  try:
48
+ ip = socket.gethostbyname(hostname)
49
+ print(f'{hostname} resolved to {ip}')
50
+ url = f'https://{hostname}/api/wake'
51
+ payload = {"data": "test"} # Replace with your actual payload
52
+ headers = {"Content-Type": "application/json"}
53
+
54
+ response = requests.post(url, json=payload, headers=headers)
55
  response.raise_for_status() # Raise an error for bad status codes
56
+ print(response.text) # Print the response from the server
57
+
58
+
59
  result_counter += 1
60
  except requests.exceptions.RequestException as e:
61
  print(f"Error ({url}):", str(e))