qgao007 commited on
Commit
6a03277
1 Parent(s): cb76f28

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +14 -7
app.py CHANGED
@@ -26,13 +26,20 @@ url = "https://146.152.226.61"
26
  resp1 = requests.get("http://3.231.107.102")
27
  print(resp1.status_code)
28
  print(resp1.text)
 
29
 
30
  while True:
31
- resp2 = requests.get(url)
32
- if resp2.status_code == 200:
33
- print('Oh yeah, you are smart!')
34
- else:
35
- print('Oh no, you are dumb!')
36
- print(resp2.status_code)
37
- print(resp2.text)
 
 
 
 
 
 
38
  # one more
 
26
  resp1 = requests.get("http://3.231.107.102")
27
  print(resp1.status_code)
28
  print(resp1.text)
29
+ print('Okay, I can connect to aws free test server.')
30
 
31
  while True:
32
+ try:
33
+ resp2 = requests.get(url)
34
+ if resp2.status_code == 200:
35
+ print('Oh yeah, you are smart!')
36
+ break
37
+ else:
38
+ print('Oh no, you are getting smart! Work harder!')
39
+ print(resp2.status_code)
40
+ print(resp2.text)
41
+ except requests.exceptions.RequestException as e:
42
+ print('Oh no, no connection!')
43
+ print(e)
44
+ time.sleep(5)
45
  # one more