1
0
Fork 0

Don't explode upon 404

Signed-off-by: Skylar "The Cobra" Widulski <cobra@vern.cc>
This commit is contained in:
Skylar "The Cobra" Widulski 2023-01-21 00:38:58 -05:00
parent 3f99b3b6c2
commit e881c24f70
Signed by untrusted user: cobra
GPG Key ID: 4FD8F812083FF6F9
1 changed files with 20 additions and 23 deletions

View File

@ -13,7 +13,6 @@ def scrape(url, arg=None):
else:
data = requests.get(f"{url}{arg}")
if data.status_code == 200:
our_path = re.sub(r".*://.*/", "/", request.url)
path = re.sub(r".*://.*/", "/", data.url)
print(our_path, path)
@ -34,8 +33,6 @@ def scrape(url, arg=None):
if pages == None:
pages = ""
return (ret, pages)
else:
return f"Couldn't get data from Urban Dictionary\n{data.status_code}"
def render(data):
return render_template('index.html', data=data)