Reformatted code to use spaces instead of tabs
This commit is contained in:
@@ -4,13 +4,13 @@ import os
|
||||
import inspect
|
||||
|
||||
currentdir = os.path.dirname(os.path.abspath(inspect.getfile(inspect.currentframe())))
|
||||
sys.path.insert(0,currentdir + '/../../../')
|
||||
sys.path.insert(0, currentdir + '/../../../')
|
||||
|
||||
import timeit
|
||||
|
||||
from sanic.response import json
|
||||
|
||||
print(json({ "test":True }).output())
|
||||
print(json({"test": True}).output())
|
||||
|
||||
print("Running New 100,000 times")
|
||||
times = 0
|
||||
@@ -20,7 +20,7 @@ for n in range(6):
|
||||
print("Took {} seconds".format(time))
|
||||
total_time += time
|
||||
times += 1
|
||||
print("Average: {}".format(total_time/times))
|
||||
print("Average: {}".format(total_time / times))
|
||||
|
||||
print("Running Old 100,000 times")
|
||||
times = 0
|
||||
@@ -30,4 +30,4 @@ for n in range(6):
|
||||
print("Took {} seconds".format(time))
|
||||
total_time += time
|
||||
times += 1
|
||||
print("Average: {}".format(total_time/times))
|
||||
print("Average: {}".format(total_time / times))
|
||||
|
||||
@@ -3,15 +3,17 @@ import os
|
||||
import inspect
|
||||
|
||||
currentdir = os.path.dirname(os.path.abspath(inspect.getfile(inspect.currentframe())))
|
||||
sys.path.insert(0,currentdir + '/../../../')
|
||||
sys.path.insert(0, currentdir + '/../../../')
|
||||
|
||||
from sanic import Sanic
|
||||
from sanic.response import json
|
||||
|
||||
app = Sanic("test")
|
||||
|
||||
|
||||
@app.route("/")
|
||||
async def test(request):
|
||||
return json({ "test": True })
|
||||
return json({"test": True})
|
||||
|
||||
app.run(host="0.0.0.0", port=sys.argv[1])
|
||||
|
||||
app.run(host="0.0.0.0", port=sys.argv[1])
|
||||
|
||||
@@ -3,7 +3,7 @@ import os
|
||||
import inspect
|
||||
|
||||
currentdir = os.path.dirname(os.path.abspath(inspect.getfile(inspect.currentframe())))
|
||||
sys.path.insert(0,currentdir + '/../../../')
|
||||
sys.path.insert(0, currentdir + '/../../../')
|
||||
|
||||
from sanic import Sanic
|
||||
from sanic.response import json, text
|
||||
@@ -11,36 +11,44 @@ from sanic.exceptions import ServerError
|
||||
|
||||
app = Sanic("test")
|
||||
|
||||
|
||||
@app.route("/")
|
||||
async def test(request):
|
||||
return json({ "test": True })
|
||||
|
||||
return json({"test": True})
|
||||
|
||||
|
||||
@app.route("/sync", methods=['GET', 'POST'])
|
||||
def test(request):
|
||||
return json({ "test": True })
|
||||
return json({"test": True})
|
||||
|
||||
|
||||
@app.route("/text/<name>/<butt:int>")
|
||||
def rtext(request, name, butt):
|
||||
return text("yeehaww {} {}".format(name, butt))
|
||||
|
||||
|
||||
@app.route("/exception")
|
||||
def exception(request):
|
||||
raise ServerError("yep")
|
||||
|
||||
|
||||
@app.route("/exception/async")
|
||||
async def test(request):
|
||||
raise ServerError("asunk")
|
||||
|
||||
|
||||
@app.route("/post_json")
|
||||
def post_json(request):
|
||||
return json({ "received": True, "message": request.json })
|
||||
return json({"received": True, "message": request.json})
|
||||
|
||||
|
||||
@app.route("/query_string")
|
||||
def query_string(request):
|
||||
return json({ "parsed": True, "args": request.args, "url": request.url, "query_string": request.query_string })
|
||||
return json({"parsed": True, "args": request.args, "url": request.url, "query_string": request.query_string})
|
||||
|
||||
|
||||
import sys
|
||||
|
||||
app.run(host="0.0.0.0", port=sys.argv[1])
|
||||
|
||||
|
||||
@@ -55,7 +63,7 @@ app.run(host="0.0.0.0", port=sys.argv[1])
|
||||
# for n in range(30):
|
||||
# connection = await asyncio_redis.Connection.create(host='192.168.99.100', port=6379)
|
||||
# sanic.redis.append(connection)
|
||||
|
||||
|
||||
|
||||
# c=0
|
||||
# @app.route("/postgres")
|
||||
|
||||
Reference in New Issue
Block a user