Last active
December 4, 2016 21:46
-
-
Save x10an14/a2ea4130979a556a637a897277cfcb50 to your computer and use it in GitHub Desktop.
Why u no such html content when accessing this endpoint? =(
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
x10an14@x10Desktop2016:~/Documents/git_projs/overtime_calculator$ venv/bin/python webapp.py | |
2016-12-04 22:44:47,201: DEBUG: | |
▄▄▄▄▄ | |
▀▀▀██████▄▄▄ _______________ | |
▄▄▄▄▄ █████████▄ / \ | |
▀▀▀▀█████▌ ▀▐▄ ▀▐█ | Gotta go fast! | | |
▀▀█████▄▄ ▀██████▄██ | _________________/ | |
▀▄▄▄▄▄ ▀▀█▄▀█════█▀ |/ | |
▀▀▀▄ ▀▀███ ▀ ▄▄ | |
▄███▀▀██▄████████▄ ▄▀▀▀▀▀▀█▌ | |
██▀▄▄▄██▀▄███▀ ▀▀████ ▄██ | |
▄▀▀▀▄██▄▀▀▌████▒▒▒▒▒▒███ ▌▄▄▀ | |
▌ ▐▀████▐███▒▒▒▒▒▐██▌ | |
▀▄▄▄▄▀ ▀▀████▒▒▒▒▄██▀ | |
▀▀█████████▀ | |
▄▄██▀██████▀█ | |
▄██▀ ▀▀▀ █ | |
▄█ ▐▌ | |
▄▄▄▄█▌ ▀█▄▄▄▄▀▀▄ | |
▌ ▐ ▀▀▄▄▄▀ | |
▀▀▄▄▀ | |
2016-12-04 22:44:47,201: INFO: Goin' Fast @ http://127.0.0.1:8000 | |
2016-12-04 22:44:48,886: INFO: Entering _test()... | |
2016-12-04 22:44:48,886: INFO: body: b'<html><h1>Hello world!</h1></html>' | |
2016-12-04 22:44:48,886: INFO: content_type: text/plain; charset=utf-8 | |
2016-12-04 22:44:48,886: INFO: cookies: {} | |
2016-12-04 22:44:48,886: INFO: headers: {} | |
2016-12-04 22:44:48,886: INFO: status: 200 | |
2016-12-04 22:44:48,886: INFO: output(): b'HTTP/1.1 200 OK\r\nContent-Type: text/plain; charset=utf-8\r\nContent-Length: 34\r\nConnection: close\r\n\r\n<html><h1>Hello world!</h1></html>' | |
2016-12-04 22:44:48,886: INFO: Done running _test()! |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
"""Webapp start-up python script for Overtime-Calculator.""" | |
import logging | |
# PIP imports: | |
from sanic.response import json as sanic_json | |
from sanic.response import text as sanic_text | |
from sanic.response import text as sanic_html | |
# Module imports: | |
from src import app | |
from src import log_function_entry_and_exit | |
@app.route("/hello") | |
@log_function_entry_and_exit | |
def _test(request): | |
# return sanic_json({"hello": "world"}) | |
# return sanic_text("Hello world!") | |
a = sanic_html("<html><h1>Hello world!</h1></html>") | |
b = [ | |
'body', | |
'content_type', | |
'cookies', | |
'headers', | |
# 'output', | |
'status' | |
] | |
for x in b: | |
logging.info("{}: {}".format(x, getattr(a, x))) | |
# logging.info("\n{}\n".format(dir(a))) | |
logging.info("{}: {}".format("output()", a.output())) | |
return a |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment