Skip to content
This repository has been archived by the owner on Jan 31, 2023. It is now read-only.

Add status code 404 as ok #1

Open
wants to merge 4 commits into
base: develop
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 7 additions & 7 deletions rendertron/middleware/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,13 +72,13 @@ def render_url(self, url, request):

try:
with urlopen(proxy_url) as response:
if response.code == 200: # What about other 'ok' codes?
data = response.read()
# Should we store the response code, headers etc?
metas = ["code", "reason", "status"]
meta = {key: getattr(response, key) for key in metas}
self.storage.store_response(request, data, meta)
return data, meta
data = response.read()
print("hello", data)
# Should we store the response code, headers etc?
metas = ["code", "reason", "status"]
meta = {key: getattr(response, key) for key in metas}
self.storage.store_response(request, data, meta)
return data, meta
except Exception:
pass
return None, None