File size: 1,088 Bytes
99d7a6c
 
 
 
 
 
 
 
 
4badeb6
9c0402a
4badeb6
 
 
 
 
 
99d7a6c
f6c533e
 
 
cb76f28
99d7a6c
4c8f75b
d35e101
 
 
 
 
 
 
 
cb76f28
4c8f75b
6a03277
 
 
 
 
 
 
 
 
 
 
 
 
bde9294
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
import os
import gradio as gr
import numpy as np
import random
import torch
import subprocess
import time
import requests
import json
import socket
import subprocess

hostname = socket.gethostname()

IPAddr=socket.gethostbyname(hostname)
print("Your Computer Name is:"+hostname)
print("Your Computer IP Address is:"+IPAddr)




url = "https://146.152.226.61"

# subprocess.run(["curl", "ipinfo.io"])
# test aws free server first
try: 
    resp1 = requests.get("http://3.231.107.102")
    if resp1.status_code == 200:
        print(resp1.status_code)
        print(resp1.text)
except:
    print('The app is having issues! please check first!')

while True:
    try:
        resp2 = requests.get(url)
        if resp2.status_code == 200: 
            print('Oh yeah, you are smart!')
            break
        else:
            print('Oh no, you are getting smart! Work harder!')
            print(resp2.status_code)
            print(resp2.text)
    except requests.exceptions.RequestException as e: 
        print('Oh no, no connection!')
        print(e)
        time.sleep(5)
# one more