Skip to content

Commit

Permalink
Fix line length linting error in handlers.py
Browse files Browse the repository at this point in the history
  • Loading branch information
asford authored and Alex Ford committed Aug 25, 2019
1 parent 5e4f0fc commit c3c99db
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions jupyter_tensorboard/handlers.py
Original file line number Diff line number Diff line change
Expand Up @@ -107,12 +107,16 @@ def check_xsrf_cookie(self):
return super(TensorboardHandler, self).check_xsrf_cookie()
except web.HTTPError:
if self.request.method in {"GET", "POST", "HEAD"}:
# Consider Referer a sufficient cross-origin check for GET requests
# Extended to post for Tensorboard API
# Consider Referer a sufficient cross-origin check for GET
# requests, mirrors logic in IPythonHandler.check_xsrf_cookie.
# Extended to POST for Tensorboard API.
if not self.check_referer():
referer = self.request.headers.get("Referer")
if referer:
msg = "Blocking Cross Origin request from {}.".format(referer)
msg = (
"Blocking Cross Origin request from {}."
.format(referer)
)
else:
msg = "Blocking request from unknown origin"
raise web.HTTPError(403, msg)
Expand Down

0 comments on commit c3c99db

Please sign in to comment.