mirror of
https://github.com/bobbimanners/ProDOS-Utils.git
synced 2024-06-15 17:29:48 +00:00
Catch errors silently. What happens in Vegas stays in Vegas.
This commit is contained in:
parent
2ac8ce06cd
commit
8d746b120c
|
@ -6,7 +6,7 @@
|
|||
#
|
||||
# Bobbi June 2020
|
||||
#
|
||||
# If this client is running on port 8000, then fetching:
|
||||
# If this client is running on raspberrypi:8000, then fetching URL:
|
||||
# http://raspberrypi:8000/www.google.com
|
||||
# Will fetch https://www.google.com
|
||||
#
|
||||
|
@ -24,7 +24,12 @@ class MyHTTPRequestHandler(http.server.SimpleHTTPRequestHandler):
|
|||
def do_GET(self):
|
||||
url = 'https:/' + self.path
|
||||
print('Getting {} ...'.format(url))
|
||||
err = False
|
||||
try:
|
||||
file = requests.get(url, allow_redirects=True)
|
||||
except:
|
||||
err = True
|
||||
if err == False:
|
||||
self.send_response(200)
|
||||
self.send_header("Content-type", "text/html")
|
||||
self.send_header("Content-length", len(file.content))
|
||||
|
|
Loading…
Reference in New Issue
Block a user