in walkthroughs/howto-k8s-retry-policy/feapp/serve.py [0:0]
def do_GET(self):
if self.path == '/ping':
self.send_response(200)
self.end_headers()
return
try:
print('Trying to hit ' + COLOR_HOST.split(':')[0])
print(socket.gethostbyname(COLOR_HOST.split(':')[0]))
req = Request(f'http://{COLOR_HOST}')
res = urlopen(req)
self.send_response(200)
self.end_headers()
self.wfile.write(res.read())
except HTTPError as e:
print(f'[ERROR] {e}')
self.send_error(e.code, e.reason)
except Exception as e:
print(f'[ERROR] {e}')
self.send_error(500, b'Something really bad happened')