Miguel Grinberg
f90288f5dc
websocket routes in blueprints
2017-02-27 22:35:28 -08:00
Miguel Grinberg
1d6e11ca10
addressed feedback
2017-02-27 22:35:28 -08:00
Miguel Grinberg
6e903ee7d5
websocket support, using websockets package
2017-02-27 22:35:28 -08:00
Raphael Deem
21fb1dff7e
fix routing issue with slashes
2017-02-27 20:01:11 -08:00
Raphael Deem
2dca53a696
remove stop_event
2017-02-26 16:37:48 -08:00
Eli Uriegas
42e1d18470
Increment version to 0.4.0
2017-02-25 13:36:47 -06:00
Raphael Deem
66c380548b
use getattr for request url in error handler
2017-02-23 23:17:31 -08:00
lixxu
28c31359bf
bug: url / will be empty
2017-02-24 00:45:50 +08:00
lixxu
ff3d33d5e0
bug: url_for in blueprint may have // at the beginning
2017-02-24 00:17:43 +08:00
Eli Uriegas
d015d6b103
Merge pull request #476 from seemethere/inject_app_into_request
...
Inject app into request object
2017-02-23 09:12:41 -06:00
messense
fedd7920a8
Fix exception collection typo
2017-02-23 10:39:14 +08:00
Eli Uriegas
56ecb6a3ea
Inject app into request object
...
Allows for injection of the app object into the request object through
the request handler.
This allows for users to setup things like database connections etc. in
listeners and then utilize them throughout the their various route
handlers.
Usage is fairly simple like so:
```python
@app.get('/')
async def handler(request):
request.app.anything
```
Name is up in the air but I'll leave this up for a few days and I'll
change it if we get a consensus
2017-02-22 11:34:14 -06:00
Eli Uriegas
64f73f624f
Merge pull request #471 from r0fls/vhost-default
...
allow default vhost
2017-02-22 11:08:28 -06:00
Suby Raman
d8a6d7e02f
response.write should be synchronous for performance reasons
2017-02-22 10:42:16 -05:00
Suby Raman
fa13ad8849
clean up imports
2017-02-21 11:36:45 -05:00
Suby Raman
8b23dec322
improve performance
2017-02-21 11:28:45 -05:00
Suby Raman
4e8aac4b41
rebase
2017-02-21 11:05:06 -05:00
Raphael Deem
9c72b557ec
allow default vhost
2017-02-20 16:52:36 -08:00
Raphael Deem
207ec1e032
route logic for trailing slash
2017-02-20 16:11:28 -08:00
hhstore
26c9618e63
fix import path.
2017-02-20 17:57:15 +08:00
Eli Uriegas
2c2a28e46b
Add better error message around app.loop
2017-02-18 12:29:25 -06:00
Eli Uriegas
c75d484f23
Merge branch 'master' of github.com:channelcat/sanic into add_app_loop_safety
2017-02-17 07:10:59 -06:00
Eli Uriegas
0b914866eb
Merge pull request #401 from youknowone/error-logging
...
Enhance error logging
2017-02-17 07:01:40 -06:00
Eli Uriegas
55dc45de33
Merge pull request #455 from seemethere/add_better_response_error_detection
...
Adds some safety around response types being wrong
2017-02-17 06:59:52 -06:00
Eli Uriegas
39aa64ff68
Remove un-needed loop assignment
2017-02-17 06:57:41 -06:00
Eli Uriegas
94bb91f2fa
Adds some safety around app loop property
2017-02-17 06:54:26 -06:00
Jeong YunWon
b44e8167d7
Enhance error logging
...
- Prevent to fall into error logging recursion when it doesn't have
request info (Print 'Unknown' when the request is still `None`
- Print repr(e) rather than str(e)
2017-02-17 14:05:46 +09:00
Eli Uriegas
ad13529eaa
Removes the extra logging message for run
...
Solves for #456
2017-02-16 21:51:19 -06:00
Eli Uriegas
04c8f4a5ed
Adds some safety around response types being wrong
...
Before we didn't check if the response object was actually a response
object. This PR catches the exception should it happen and reports it to
the user.
2017-02-16 17:49:14 -06:00
Eli Uriegas
865506546f
Merge pull request #440 from r0fls/isinstance
...
isinstance -> try/except
2017-02-16 17:19:04 -06:00
Eli Uriegas
fe72fadedd
Merge pull request #432 from agoose77/cleanups
...
Bugfix & simplfication for host based routing
2017-02-16 17:18:24 -06:00
Eli Uriegas
483b442b7d
Default request.args to RequestParameters
2017-02-16 15:54:20 -06:00
Alec Buckenheimer
f9ab24a077
#449 use stdlib json module if ujson is unavailible
2017-02-16 15:03:52 -05:00
Raphael Deem
6726affa7e
isinstance -> try/except
2017-02-15 19:34:45 -08:00
Eli Uriegas
6ecf2a6eb2
Merge pull request #439 from seemethere/move_sanic_to_app
...
Moves sanic/sanic.py to sanic/app.py
2017-02-15 21:03:41 -06:00
Eli Uriegas
a359e11f97
Merge pull request #422 from r0fls/420
...
move logging to method in ErrorHandler
2017-02-15 21:03:15 -06:00
Eli Uriegas
54b2d74068
Get rid of relative imports
2017-02-15 20:54:00 -06:00
Eli Uriegas
c99aa7279b
Moves sanic/sanic.py to sanic/app.py
...
Functionality wise this won't change much for most users, unless you
were directly importing from `sanic.sanic` in which case I am sorry if
you're affected by this.
Main motivation was because jedi autocompletion didn't work with this
and we were using relative imports to compensate for the fact that
having a module inside of your module with the same name creates major
namespace problems.
2017-02-15 20:47:34 -06:00
Eli Uriegas
874698b93f
Merge pull request #431 from subyraman/test-client-v2
...
Add Flask-like `test_client` to replace `sanic_endpoint_test`
2017-02-15 15:44:30 -06:00
Raphael Deem
1cf1024332
Merge branch 'master' into 420
2017-02-15 09:29:52 -08:00
Raphael Deem
efc90f8f5a
Merge pull request #434 from agoose77/fix_warn_error
...
Fix mistake in warning
2017-02-14 16:46:37 -08:00
Angus Hollands
6535ba7c24
Fix mistake in warning
2017-02-14 20:53:55 +00:00
Angus Hollands
5c29c3d160
Merge branch 'master' of https://github.com/channelcat/sanic into cleanups
2017-02-14 20:47:28 +00:00
Angus Hollands
742d4bff78
Change to iterable as Python3.5 doesn't support Collection.
...
We don't really need the getitem and len attributes anyway
2017-02-14 20:46:14 +00:00
Angus Hollands
b442d78ebb
Bugfix & simplfication for host based routing (if list of hosts passed after a previous vhost route was added, previously attempted to add set to set)
...
Add comment documenting substandard behaviour
2017-02-14 20:32:04 +00:00
Eli Uriegas
d44edb5930
Merge pull request #430 from aquacash5/master
...
Added raw response for bag o' bytes responses
2017-02-14 14:19:01 -06:00
Suby Raman
d5633b3705
fix deprecation message
2017-02-14 15:16:58 -05:00
Suby Raman
3b68dc72e7
rework testing
2017-02-14 14:51:20 -05:00
Angus Hollands
51611c3934
Pep8 cleanups ( #429 )
...
* PEP8 cleanups
* PEP8 cleanups (server.py)
* PEP8 cleanups (blueprints.py)
* PEP8 cleanups (config.py)
* PEP8 cleanups (cookies.py)
* PEP8 cleanups (handlers.py)
* PEP8 cleanups (request.py)
* PEP8 cleanups (response.py)
* PEP8 cleanups (router.py)
* PEP8 cleanups (sanic.py) #2
* PEP8 cleanups (server.py) #2
* PEP8 cleanups (static.py)
* PEP8 cleanups (utils.py)
* PEP8 cleanups (views.py)
Updated docstring
2017-02-14 13:10:19 -06:00
Kyle Blöm
747b7567d7
Changed docstring for raw response
2017-02-14 09:40:33 -08:00
Kyle Blöm
797891d6cf
Added raw response for bag o' bytes responses
2017-02-14 09:27:39 -08:00
Eli Uriegas
286dc3c32b
Merge pull request #399 from lixxu/master
...
improve url_for to support multi values and special options
2017-02-14 10:27:54 -06:00
Eli Uriegas
b139810b6a
Merge pull request #424 from growingdever/blueprint-support-view
...
support view instance for blueprint add_route method
2017-02-14 10:26:05 -06:00
Angus Hollands
56f56d008a
Simplify trigger events (now guaranteeed to receive list of events)
...
Don't bother checking if list empty - this function is not called often
2017-02-14 15:15:15 +00:00
growingdever
81a8a99b6e
wrap over width comment
2017-02-14 17:20:39 +09:00
growingdever
07aa0ee7ad
- copy codes from Sonic.add_route
...
- modify comment by r0fls
2017-02-14 17:15:38 +09:00
growingdever
b66a6bddbc
fix typo
2017-02-14 14:30:07 +09:00
growingdever
d57d90fe6b
- make blueprint add_route method support view instance
...
- update documentation that doesn't specify url_prefix parameter
2017-02-14 14:23:22 +09:00
Raphael Deem
de6c646ee8
move logging to method in ErrorHandler
2017-02-13 19:44:54 -08:00
lixxu
4839ede64f
update test for url_for and update routing.md doc
2017-02-14 10:26:30 +08:00
Raphael Deem
7a3f5d508b
fix merge conflicts
2017-02-13 14:19:44 -08:00
Eli Uriegas
1660041470
Merge pull request #408 from agoose77/master
...
Use app decorator instead of run arguments for before_start
2017-02-13 12:54:46 -06:00
Suby Raman
b2be821637
reverse router changes
2017-02-13 11:55:00 -05:00
Suby Raman
051ff2b325
remove repr stuff
2017-02-13 11:50:09 -05:00
Suby Raman
4d6f9ffd7c
rebase
2017-02-13 11:45:55 -05:00
Suby Raman
d614823013
rebase
2017-02-13 11:38:28 -05:00
Eli Uriegas
48aa51b739
Merge pull request #413 from r0fls/loop-signal-handlers
...
use try/except when adding loop sig handlers
2017-02-13 10:13:56 -06:00
Raphael Deem
41c6125e1b
use try/except when adding loop sig handlers
2017-02-12 14:43:00 -08:00
Eli Uriegas
bb3d48f98b
Merge pull request #412 from seemethere/improving_performance
...
Header performance gains
2017-02-12 15:48:45 -06:00
Raphael Deem
b5e46e83e2
ensure_future -> add_task
2017-02-12 12:29:12 -08:00
Angus Hollands
2340910b46
Update deprecation message
...
Fix bug with single callbacks
2017-02-12 18:15:14 +00:00
Eli Uriegas
d8c4c1525d
Merge pull request #406 from agoose77/master_pre_patches_1
...
Cleanup middleware decorator
2017-02-12 12:14:50 -06:00
Eli Uriegas
6713ef7726
Remove unused import
2017-02-12 12:09:06 -06:00
Eli Uriegas
ae7555b065
Performance was down so this brings it back up
...
Changes from #378 introduced about a 10k request/sec slowdown. This
tries to rememdy it while keeping the same functionality but it's still
not as fast as 0.3.1
2017-02-12 12:05:14 -06:00
Angus Hollands
ee6ff0cc60
Add deprecation and old API
2017-02-12 12:28:02 +00:00
Raphael Deem
94b2352c2c
add ensure_future method
2017-02-11 17:40:17 -08:00
Raphael Deem
0e1bb6ab04
add loop property
2017-02-11 16:28:35 -08:00
Angus Hollands
8b08a370c5
Remove todo
2017-02-11 14:39:32 +00:00
Angus Hollands
b5e50ecb75
Use app decorator instead of run arguments for before_start
...
Mirror listener of blueprints
2017-02-11 14:30:17 +00:00
Angus Hollands
e00c9d0ee0
Fix line length
2017-02-11 12:39:04 +00:00
Angus Hollands
be9c9f045a
Cleanup middleware decorator
2017-02-11 12:27:25 +00:00
lixxu
fb419eaa36
fix bug: netloc always in url if SERVER_NAME defined in config even _external not true
2017-02-09 18:26:17 +08:00
lixxu
cf2a363e5e
improve url_for to support multi values for one arg, add _anchor/_external/_scheme options
2017-02-09 16:44:23 +08:00
Eli Uriegas
579afe012b
Fixes errors related to #378
2017-02-08 19:59:34 -06:00
Eli Uriegas
eb059183f7
Merge branch 'master' into master
2017-02-08 19:37:32 -06:00
Eli Uriegas
419156f7cc
Merge pull request #397 from seemethere/increment_031
...
Increment to v0.3.1
2017-02-08 19:23:20 -06:00
Eli Uriegas
b7f7883fb7
Increment to v0.3.1
2017-02-08 19:22:51 -06:00
Eli Uriegas
a5a7490bca
Merge pull request #379 from youknowone/exception
...
Let exception handler handle inherited exceptions
2017-02-08 19:20:42 -06:00
Eli Uriegas
6724d8131c
Merge pull request #387 from subyraman/url-for-v3
...
Add `url_for` method for simple routes, blueprints, HTTPMethodView
2017-02-08 19:20:09 -06:00
Raphael Deem
a19bb15070
Merge pull request #389 from chenfengyuan/fix_run_async_demo
...
fix run_async demo
2017-02-07 14:58:48 -08:00
Eli Uriegas
2ee0147848
Merge pull request #386 from youknowone/sanic_endpoint_test
...
Fix sanic_endpoint_test working with redirects
2017-02-07 10:57:05 -06:00
Jeong YunWon
413c92c631
Let exception handler handle inherited exceptions
...
Original sanic exception handler only could handle exact matching
exceptions. New `lookup` method will provide ability to looking up
their ancestors without additional cost of performance.
2017-02-07 21:08:31 +09:00
Suby Raman
36d519026f
reject unnamed handlers
2017-02-06 11:11:00 -05:00
Fengyuan Chen
aa54785918
fix always warning loop is passed issue
2017-02-06 11:11:00 -05:00
Jeong YunWon
a15ee3ad06
Fix sanic_endpoint_test working with redirects
...
Before fix, it raises error like:
```
tests/test_utils.py F
================================= FAILURES =================================
______________________________ test_redirect _______________________________
app = <sanic.sanic.Sanic object at 0x1045fda20>, method = 'get', uri = '/1', gather_request = True, debug = False
server_kwargs = {}, request_args = (), request_kwargs = {}
_collect_request = <function sanic_endpoint_test.<locals>._collect_request at 0x1045ec950>
_collect_response = <function sanic_endpoint_test.<locals>._collect_response at 0x1045ec7b8>
def sanic_endpoint_test(app, method='get', uri='/', gather_request=True,
debug=False, server_kwargs={},
*request_args, **request_kwargs):
results = []
exceptions = []
if gather_request:
def _collect_request(request):
results.append(request)
app.request_middleware.appendleft(_collect_request)
async def _collect_response(sanic, loop):
try:
response = await local_request(method, uri, *request_args,
**request_kwargs)
results.append(response)
except Exception as e:
exceptions.append(e)
app.stop()
app.run(host=HOST, debug=debug, port=PORT,
after_start=_collect_response, **server_kwargs)
if exceptions:
raise ValueError("Exception during request: {}".format(exceptions))
if gather_request:
try:
> request, response = results
E ValueError: too many values to unpack (expected 2)
sanic/utils.py:47: ValueError
During handling of the above exception, another exception occurred:
utils_app = <sanic.sanic.Sanic object at 0x1045fda20>
def test_redirect(utils_app):
"""Test sanic_endpoint_test is working for redirection"""
> request, response = sanic_endpoint_test(utils_app, uri='/1')
tests/test_utils.py:33:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
app = <sanic.sanic.Sanic object at 0x1045fda20>, method = 'get', uri = '/1', gather_request = True, debug = False
server_kwargs = {}, request_args = (), request_kwargs = {}
_collect_request = <function sanic_endpoint_test.<locals>._collect_request at 0x1045ec950>
_collect_response = <function sanic_endpoint_test.<locals>._collect_response at 0x1045ec7b8>
def sanic_endpoint_test(app, method='get', uri='/', gather_request=True,
debug=False, server_kwargs={},
*request_args, **request_kwargs):
results = []
exceptions = []
if gather_request:
def _collect_request(request):
results.append(request)
app.request_middleware.appendleft(_collect_request)
async def _collect_response(sanic, loop):
try:
response = await local_request(method, uri, *request_args,
**request_kwargs)
results.append(response)
except Exception as e:
exceptions.append(e)
app.stop()
app.run(host=HOST, debug=debug, port=PORT,
after_start=_collect_response, **server_kwargs)
if exceptions:
raise ValueError("Exception during request: {}".format(exceptions))
if gather_request:
try:
request, response = results
return request, response
except:
raise ValueError(
"Request and response object expected, got ({})".format(
> results))
E ValueError: Request and response object expected, got ([{}, {}, {}, <ClientResponse(http://127.0.0.1:42101/3 ) [200 OK]>
E <CIMultiDictProxy('Content-Type': 'text/plain; charset=utf-8', 'Content-Length': '2', 'Connection': 'keep-alive', 'Keep-Alive': 'timeout=1')>
E ])
sanic/utils.py:52: ValueError
```
2017-02-05 13:57:04 +09:00
Fengyuan Chen
29680cb515
fix always warning loop is passed issue
2017-02-04 16:09:09 +08:00
Fengyuan Chen
884749f345
fix run_async demo
2017-02-04 15:27:46 +08:00
Suby Raman
5632d073be
update docs
2017-02-02 13:00:15 -05:00
Suby Raman
f9056099f9
all works
2017-02-02 12:52:48 -05:00
Suby Raman
7c09ec29f7
rebase
2017-02-02 12:21:14 -05:00
Eli Uriegas
6f0b09509e
Merge pull request #213 from sfstpala/master
...
Make it possible to disable the logo by subclassing Config
2017-02-01 23:07:52 -06:00
Raphael Deem
b29f648148
typo: async_run -> run_async
2017-01-31 12:46:02 -08:00
Eli Uriegas
487e3352e4
Revert "fix async run, add tests"
...
This reverts commit 41da793b5a
.
2017-01-31 07:30:17 -06:00
Eli Uriegas
17a92a58b2
Merge pull request #369 from r0fls/fix-async-run
...
fix async run, add tests
2017-01-30 22:21:25 -06:00
Kyle Blöm
d193a1eb70
Added the tests, code formatting changes, and the Range Request feature.
2017-01-30 17:04:51 -08:00
Eli Uriegas
6d18fb6bae
Merge pull request #363 from r0fls/run-helper
...
Run helper
2017-01-30 05:51:50 -06:00
Raphael Deem
41da793b5a
fix async run, add tests
2017-01-29 23:47:47 -08:00
Channel Cat
0ef39f35ae
Added route shorthands to blueprints
2017-01-29 23:20:38 -08:00
Channel Cat
4c80cd185f
Fix flake8
2017-01-29 17:44:46 -08:00
Channel Cat
629524af04
Restructured blueprint class
...
Blueprints currently queue functions to be called, which are simple, yet
hard to inspect. These changes allow tools to be built that analyze
blueprints more easily.
2017-01-29 17:39:55 -08:00
Raphael Deem
82d1d30a41
review updates
2017-01-29 14:01:00 -08:00
Raphael Deem
10dbb9186d
combine logic from create_server() and run()
2017-01-29 13:36:13 -08:00
Eli Uriegas
a547798b08
Merge pull request #360 from seemethere/fix_route_overloading_for_dynamic_routes
...
Fixes route overloading for dynamic routes
2017-01-29 15:35:13 -06:00
Eli Uriegas
f56c5e3a45
Merge pull request #199 from Tim-Erwin/improved_config
...
added methods to load config from a file
2017-01-29 15:27:34 -06:00
Eli Uriegas
0a5fa72099
Add logic to make dynamic route merging work
...
This is by no means the final solution but it's a start in the right
direction. Eventually what needs to happen is we need to reduce the
complexity of the routing. CompsitionView can probably be removed later
on in favor of better Route objects. Also in the next version of sanic
we need to move merge_route and add_parameter out of the add_route logic
and just have them as standalone methods.
The tests should cover everything that we need so that if any changes
are made we can identify regression.
2017-01-29 15:16:07 -06:00
Raphael Deem
753d2da6db
fix async run
2017-01-28 15:47:29 -08:00
Eli Uriegas
d3344da9c5
Add a pesky newline
2017-01-27 22:15:34 -06:00
Eli Uriegas
dea8e16f49
Force method to lower
2017-01-27 22:07:31 -06:00
Eli Uriegas
13803bdb30
Update for HTTPMethodView compatibility
2017-01-27 22:05:46 -06:00
Eli Uriegas
41c52487ee
Fixes route overloading for dynamic routes
...
Addresses #353 , now dynamic routes work alongside our newly minted
overloaded routes! Also fixed an unintended side effect where methods
were still being passed in as None for `Sanic.add_route`.
2017-01-27 21:00:33 -06:00
Raphael Deem
0eb779185d
fix deprecation warnings
2017-01-27 18:09:19 -08:00
Eli Uriegas
cfc32d940a
Increment version to 0.3.0
2017-01-27 19:36:03 -06:00
Eli Uriegas
59242df7d6
Move serve_multiple, fix tests ( #357 )
...
* Move serve_multiple, remove stop_events, fix tests
Moves serve_multiple out of the app, removes stop_event (adds a
deprecation warning, but it also wasn't doing anything) fixes
multiprocessing tests so that they don't freeze pytest's runner.
Other notes:
Also moves around some imports so that they are better optimized as
well.
* Re-add in stop_event, maybe it wasn't so bad!
* Get rid of unused warnings import
2017-01-27 19:34:21 -06:00
Eli Uriegas
fad9fbca6f
Merge pull request #335 from r0fls/remove-loop
...
remove loop as argument and update examples
2017-01-27 19:25:09 -06:00
Jordan Pittier
fa36dcbe09
Use `isinstance(
instead of
issubclass(type(
`
...
When we already have an `instance` it's less typing and faster to
use `isinstance`.
2017-01-27 11:11:29 +01:00
Raphael Deem
c72bcc136c
add semaphore concurrency limit example
2017-01-26 17:43:54 -08:00
Raphael Deem
d52f5f0b09
remove loop as argument and update examples
2017-01-26 17:38:46 -08:00
Raphael Deem
2774414f9e
Merge pull request #350 from r0fls/deprecate-loop
...
add deprecate loop message
2017-01-26 15:24:43 -08:00
Raphael Deem
965fbc917d
use string formatting in start message
2017-01-26 15:11:53 -08:00
Raphael Deem
2a1b63c93c
add deprecate loop message
2017-01-26 15:07:42 -08:00
Eli Uriegas
d1c4f3172f
Merge pull request #348 from r0fls/275
...
add async run
2017-01-26 10:37:52 -06:00
Raphael Deem
14697c7ea9
review changes
2017-01-26 08:36:00 -08:00
Raphael Deem
54ca8c787b
add async run
2017-01-25 22:47:18 -08:00
Channel Cat
88c3bffe20
Merge pull request #342 from channelcat/fix-slow-upload
...
Fix slow upload
2017-01-25 22:04:48 -08:00
Channel Cat
fd118a41fd
Only use request.body
2017-01-25 21:56:49 -08:00
Raphael Deem
a162f2ce34
Merge branch 'master' into cookie-usability
2017-01-25 21:24:30 -08:00
Raphael Deem
3c355f19eb
false cookie attributes should not be set
2017-01-25 16:47:14 -08:00
Raphael Deem
4efcb6d5ad
fix before/after event docstrings
2017-01-25 16:25:16 -08:00
Channel Cat
d0a121ad06
Added del cookie and default path
2017-01-25 01:53:39 -08:00
Channel Cat
85a28d3c30
Fix slow upload
2017-01-25 01:19:21 -08:00
Tim Mundt
5bba3388a0
Merge branch 'master' into improved_config
2017-01-25 09:36:21 +01:00
Raphael Deem
28f7abd1f8
set error handler debug from run debug arg
2017-01-24 17:24:06 -08:00
Raphael Deem
afe390d407
Merge pull request #253 from dutradda/add_register_sys_signals_flag
...
add a flag to skip SIGINT and SIGTERM signals registration
2017-01-21 23:09:12 -08:00
ctlaltdefeat
592ee5f839
fixed line length to satisfy travis
2017-01-21 23:02:02 +02:00
ctlaltdefeat
a811c84e99
allowed passing arguments to json response encoder
2017-01-21 22:40:34 +02:00
Eli Uriegas
214162adf0
Merge branch 'master' into add_register_sys_signals_flag
2017-01-21 10:25:57 -06:00
Raphael Deem
28396c8620
Merge pull request #327 from awiddersheim/logging-override
...
Make it easier to override logging
2017-01-20 16:23:03 -08:00
Andrew Widdersheim
72fba62e09
Make it easier to override logging
...
Take influence from how Werkzeug configures logging by only configuring
a handler if no root handlers were previously configured by the end
user.
2017-01-20 18:26:55 -05:00
Eli Uriegas
e5cbf25cbd
Merge pull request #325 from seemethere/add_key_error
...
Simplify RequestParameters
2017-01-20 15:27:00 -06:00
Eli Uriegas
7780a8c187
Merge pull request #320 from r0fls/method-decorators
...
add method shorthands
2017-01-20 14:38:34 -06:00
Eli Uriegas
a7cd4ccd09
Simplify RequestParameters
...
Simplifies request parameters, it defined a bit more than it had too,
added some docstrings and made the code simpler as well. Should now
raise a KeyError on __getitem__ as @amsb had noted on commit 9dd954b
2017-01-20 14:31:24 -06:00
Raphael Deem
96424b6b0a
add method shorthands
2017-01-20 00:07:22 -08:00
Eli Uriegas
bef34d66f5
Merge pull request #314 from seemethere/make_closed_transport_handling_more_robust
...
Add exception handling for closed transports
2017-01-19 21:31:30 -06:00
Eli Uriegas
c6049be688
Merge pull request #316 from youknowone/route-get
...
For function decorators, ['GET'] is the default methods
2017-01-19 21:31:06 -06:00
Eli Uriegas
ed4752bbc0
Move transport close to finally statment
2017-01-19 16:35:48 -06:00
Cadel Watson
7c4ffa8866
Merge branch 'master' into sphinx-docs
2017-01-20 09:30:42 +11:00
Eli Uriegas
a79f073077
Merge pull request #228 from seanpar203/issue_41
...
Adding more docstrings
2017-01-19 16:18:28 -06:00
Raphael Deem
d2217b5c5f
Merge branch 'master' into ssl
2017-01-19 11:23:21 -08:00
Jeong YunWon
0a160c4a0b
For function decorators, ['GET'] is the default methods
2017-01-19 23:56:51 +09:00
James Michael DuPont
ba60659894
untie
2017-01-19 04:04:16 -05:00
zkanda
cc43ee3b3d
Always log of there's an exception occured.
2017-01-19 16:03:12 +08:00
Eli Uriegas
5a7b70c054
Merge pull request #313 from r0fls/logging-var
...
remove logger from run
2017-01-18 23:50:07 -06:00
Eli Uriegas
e9bfa30c1d
Add exception handling for closed transports
...
Adds handling for closed transports in the server for `write_response`
as well as `write_error`, letting it all flow to `bail_out` seemed to be
a little light handed in terms of telling the logs where the
error actually occured.
Handling to fix the infinite `write_error` loop is still there and those
exceptions will get reported on in the debug logs.
2017-01-18 23:46:22 -06:00
Raphael Deem
bb83a25a52
remove logger from run
2017-01-18 21:45:30 -08:00
Raphael Deem
2c1ff5bf5d
allow using a list of hosts on a route
2017-01-18 19:41:32 -08:00
Jeong YunWon
11f3c79a77
Feature: Routing overload
...
When user specifies HTTP methods to function handlers, it automatically
will be overloaded unless they duplicate.
Example:
# This is a new route. It works as before.
@app.route('/overload', methods=['GET'])
async def handler1(request):
return text('OK1')
# This is the exiting route but a new method. They are merged and
# work as combined. The route will serve all of GET, POST and PUT.
@app.route('/overload', methods=['POST', 'PUT'])
async def handler2(request):
return text('OK2')
# This is the existing route and PUT method is the duplicated method.
# It raises RouteExists.
@app.route('/overload', methods=['PUT', 'DELETE'])
async def handler3(request):
return text('Duplicated')
2017-01-19 07:12:45 +09:00
Cadel Watson
9d4b104d2d
Merge branch 'master' into sphinx-docs
2017-01-19 08:48:54 +11:00
Raphael Deem
9102a9cd6e
Merge branch 'master' into ssl
2017-01-17 18:09:33 -08:00
Eli Uriegas
573d1da0ef
Fixes write_error loop from bail_out function
...
Fixes stack-overflow found in #307
2017-01-17 18:28:22 -06:00
Raphael Deem
ba1e006585
update logging placement
2017-01-17 15:49:17 -08:00
Eli Uriegas
9108a4c69f
Merge pull request #291 from subyraman/master
...
Add rich HTML traceback in debug mode, add HTML 500 page in prod
2017-01-17 15:47:37 -06:00
Guilherme Polo
5903dd2939
cannot use the new .ip without updating __slots__
2017-01-17 02:58:45 -02:00
Eli Uriegas
55b39a3f15
Merge pull request #301 from r0fls/cache-remote-ip
...
cache the remote IP property
2017-01-16 20:07:53 -06:00
Raphael Deem
9bc69f7de9
use hasattr
2017-01-16 17:35:08 -08:00
Channel Cat
2aa380c5a3
Merge pull request #302 from channelcat/request-headers-ci
...
Trimmed down features of CIMultiDict
2017-01-16 17:08:12 -08:00
Channel Cat
638fbcb619
Encoding needs a default
2017-01-16 17:03:55 -08:00
Channel Cat
ccbbce0036
Fix header capitalization on input
...
also removed redundant utf-8 in encodes/decodes
2017-01-16 16:55:55 -08:00
Channel Cat
41918eaf0a
Trimmed down features of CIMultiDict
2017-01-16 16:12:42 -08:00
Eli Uriegas
5c344f7efa
Remove redundant else
2017-01-16 17:51:56 -06:00
Raphael Deem
213580ea78
cache the remote IP property
2017-01-16 15:48:55 -08:00
Ubuntu
2cf4baddfb
Moved Remote-Addr header to request.ip so it can be pulled on-demand
2017-01-16 23:27:50 +00:00
Eli Uriegas
48d496936a
Merge pull request #294 from subyraman/redirect
...
Add redirect method from @pcdinh
2017-01-16 13:53:02 -06:00
Eli Uriegas
e2a16f96a8
Increment version to 0.2.0
2017-01-14 11:24:31 -06:00
Matt Daue
49fdc6563f
Add SSL to server
...
Add ssl variable passthrough to following:
-- sanic.run
-- server.serve
Add ssl variable to loop.create_server to enable built-in async context socket wrapper
Update documentation
Tested with worker = 1, and worker = 2.
Signed-off-by: Matt Daue <mattdaue@gmail.com>
2017-01-14 07:16:59 -05:00
Suby Raman
b5bbef09c5
add redirect method
2017-01-14 00:47:28 -05:00
Suby Raman
02b9a0a297
add redirect code from @pcdinh
2017-01-14 00:41:54 -05:00
Tim Mundt
0b9094d348
Merge branch 'master' into improved_config
2017-01-13 12:34:56 +01:00
Suby Raman
8c5e214131
html and tests pass
2017-01-12 19:54:34 -05:00
Eli Uriegas
9dd954bccd
Update request.form to work with __getitem__
2017-01-11 16:55:34 -06:00
Eli Uriegas
a02eb8e7cb
Merge pull request #284 from r0fls/remove-defualt-type
...
remove default from host in _get method
2017-01-11 10:01:11 -06:00
Raphael Deem
15e4ec7ffb
add ability to override default host in blueprint
2017-01-10 22:08:15 -08:00
Raphael Deem
62df50e22b
add vhosts to blueprints
2017-01-10 21:35:07 -08:00
Raphael Deem
055430d4b8
remove default from host in _get method
2017-01-10 16:01:21 -08:00
Raphael Deem
4f832ac9af
add support for virtual hosts
2017-01-08 18:46:29 -08:00
Eli Uriegas
b0bf989056
Merge pull request #261 from yoloseem/parsed_json
...
Cache request.json even when it's empty.
2017-01-08 11:57:33 -06:00
Eli Uriegas
fd0e8624c4
Merge pull request #276 from r0fls/workers
...
Fix multiple worker problem
2017-01-08 11:57:10 -06:00
Raphael Deem
f8e6becb9e
skip multiprocessing tests
2017-01-07 18:58:02 -08:00
Raphael Deem
dd28d70680
fix stop event
2017-01-07 18:46:38 -08:00
Raphael Deem
ed8e3f237c
this branch is broken
2017-01-07 15:28:21 -08:00
Raphael Deem
77c04c4cf9
fix multiple worker problem
2017-01-07 12:57:14 -08:00
Anton Zhyrney
47a4f34cdf
tests&small update
2017-01-07 07:13:49 +02:00
Anton Zhyrney
1317b1799c
add docstrings&updated docs
2017-01-07 06:57:07 +02:00
Anton Zhyrney
fcae4a9f0a
added as_view
2017-01-07 06:30:23 +02:00
Eli Uriegas
baf8254907
Change Ellipsis to None for consistency
2017-01-05 15:29:57 -06:00
Raphael Deem
616e20d467
move backlog to run()
2017-01-04 09:31:06 -08:00
Raphael Deem
e7922c1b54
add configurable backlog #263
2017-01-03 18:36:31 -08:00
Eli Uriegas
16959caa34
Merge pull request #259 from yoloseem/route
...
Correct Router documentation
2017-01-03 18:47:54 -06:00
Eli Uriegas
0675f388b9
Merge pull request #255 from seemethere/add_more_verbose_debug_error_handling
...
Add more verbose debug error handling
2017-01-03 15:43:26 -06:00
Eli Uriegas
8a9b1fee14
Merge pull request #265 from youknowone/test-middleware-schedule
...
Prevent flooding of meaningless traceback in `sanic_endpoint_test`
2017-01-03 14:41:23 -06:00
Jeong YunWon
e6eb697bb2
Use constant PORT rather than literal in test code ( #266 )
2017-01-03 14:40:13 -06:00
Eli Uriegas
4ccc782e29
Merge pull request #209 from 38elements/protocol
...
Customizable protocol
2017-01-03 11:52:54 -06:00
Hyunjun Kim
cfdd9f66d1
Correct sanic.router.Router documentation
2017-01-02 14:32:22 +09:00
Hyunjun Kim
035cbf84ae
Cache request.json even when it's null or empty
...
In case of request body is set to `{}`, `[]` or `null`, even it's
already processed, parsed_json won't be used due to its boolean
evaluation.
2017-01-02 14:20:20 +09:00
Jeong YunWon
87c24e5a7c
Prevent flooding of meaningless traceback in sanic_endpoint_test
...
When Sanic has an exception in a request middleware, it fails to
save request object in `results`. In `sanic_endpoint_test`, because
it always requires `results` to have both `request` and `response` objects,
it prints traceback like attached example. It is not a user code and
it doesn't give any information to users, it is better to suppress
to print this kind of error.
To fix it, this patch insert collect hook as first request middleware
to guarantee to successfully run it always.
```
app = <sanic.sanic.Sanic object at 0x1102b5358>, method = 'get', uri = '/ping/', gather_request = True, loop = None
debug = True, request_args = (), request_kwargs = {}
_collect_request = <function sanic_endpoint_test.<locals>._collect_request at 0x11286c158>
_collect_response = <function sanic_endpoint_test.<locals>._collect_response at 0x11286c378>
def sanic_endpoint_test(app, method='get', uri='/', gather_request=True,
loop=None, debug=False, *request_args,
**request_kwargs):
results = []
exceptions = []
if gather_request:
@app.middleware
def _collect_request(request):
results.append(request)
async def _collect_response(sanic, loop):
try:
response = await local_request(method, uri, *request_args,
**request_kwargs)
results.append(response)
except Exception as e:
exceptions.append(e)
app.stop()
app.run(host=HOST, debug=debug, port=42101,
after_start=_collect_response, loop=loop)
if exceptions:
raise ValueError("Exception during request: {}".format(exceptions))
if gather_request:
try:
> request, response = results
E ValueError: not enough values to unpack (expected 2, got 1)
../sanic/sanic/utils.py:46: ValueError
```
2017-01-02 13:18:22 +09:00
Eli Uriegas
552ff9d736
Merge pull request #235 from yoloseem/patch-1
...
Allow Sanic-inherited application
2016-12-31 13:21:44 -06:00
Eli Uriegas
738396c2e2
Merge pull request #236 from seanpar203/token_property
...
Add token property to request
2016-12-31 13:21:12 -06:00
Eli Uriegas
9f18b5a096
Merge pull request #248 from youknowone/debuggable-typecheck
...
Handle hooks parameters in more debuggable way
2016-12-31 13:17:06 -06:00
Eli Uriegas
7a8fd6b0df
Add more verbose error handling
...
* Adds logging to error messages in debug mode as pointed out in PR #249 ,
while also improving the debug message.
2016-12-30 13:48:17 -06:00
Eli Uriegas
f1c2854358
Merge branch 'master' into 178
2016-12-30 12:15:08 -06:00
Eli Uriegas
87559a34f8
Include more explicit loop for headers conversion
...
Also merges master changes into this PR for this branch
2016-12-30 12:13:16 -06:00
Eli Uriegas
9586351f37
Merge pull request #243 from dutradda/add_remove_route_method
...
created methods to remove a route from api/router
2016-12-30 09:39:57 -06:00
Diogo
0f6ed642da
created methods to remove a route from api/router
2016-12-30 07:36:57 -02:00
Diogo Dutra
6d1d4ade19
add a flag to skip SIGINT and SIGTERM signals registration
2016-12-29 19:35:41 -02:00
38elements
ee8f8c2930
Merge branch 'master' into protocol
2016-12-29 16:44:15 +09:00
38elements
83e9d08853
Add document for custom protocol
2016-12-29 13:11:27 +09:00
Jeong YunWon
15e7d8ab2e
Handle hooks parameters in more debuggable way
...
1. not list() -> callable()
The args of hooking parameters of Sanic have to be callables.
For wrong parameters, errors will be generated from:
```
listeners += args
```
By checking just list type, the raised error will be associated
with `[args]` instead of `args`, which is not given by users.
With this patch, the raised error will be associated with `args`.
Then users can notice their argument was neither callable nor list
in the easier way.
2. Function -> Functions in document
Regarding the parameter as a list is harmless to the user code.
But unawareness of its type can be list can limit the potent of
the user code.
2016-12-28 18:14:57 +09:00
Raphael Deem
a4f77984b7
stop multiple worker server without sleep loop; issue #73
2016-12-26 14:51:16 -08:00
38elements
ac44900fc4
Add test and example for custom protocol
2016-12-26 23:41:10 +09:00
Sean Parsons
986b0aa106
Added token property to request object.
2016-12-26 06:41:41 -05:00
Hyunjun Kim
01b42fb399
Allow Sanic-inherited application
2016-12-26 20:37:16 +09:00
Eli Uriegas
2d4512cd1c
Merge branch 'master' into improved_config
2016-12-25 15:26:33 -08:00
Eli Uriegas
5402e6d3a6
Merge pull request #212 from r0fls/176
...
allow overriding logging basicConfig settings
2016-12-25 09:13:51 -08:00
Cadel Watson
52c59e7133
Fix all docstring errors.
...
When generating documentation with sphinx-apidoc, there are currently
many docstring errors, mostly minor. This commit fixes all errors.
2016-12-25 20:43:45 +11:00
Raphael Deem
be9eca2d63
use try/except
2016-12-24 23:05:03 -08:00
Sean Parsons
d5ad5e46da
Update response docstrings to be explicit on whats returned.
2016-12-25 01:24:17 -05:00
Sean Parsons
a486fb99a9
Updated json function docstrings to be more consistent.
2016-12-25 01:06:40 -05:00
Sean Parsons
2b10860c32
Added docstrings to sanic.response.py for issue 41
2016-12-25 01:05:26 -05:00
Sean Parsons
a03f216f42
Added additional docstrings to blueprints.py
2016-12-25 00:47:51 -05:00
Raphael Deem
7d7cbaacf1
header format function
2016-12-24 20:56:13 -08:00
Raphael Deem
00b5a496dd
type -> isinstance
2016-12-24 20:56:13 -08:00
Raphael Deem
7e6c92dc52
convert header values to strings
2016-12-24 20:56:13 -08:00
Eli Uriegas
cf7616ebe5
Increment version to 0.1.9
2016-12-24 18:51:16 -08:00
Eli Uriegas
67a50becb0
Merge pull request #215 from cr0hn/patch-1
...
Improvement: avoid to encoding in each HTTP Response
2016-12-24 18:41:01 -08:00
Eli Uriegas
d7e94473f3
Use a try/except, it's a bit faster
...
Also reorder some imports and add some comments
2016-12-24 18:37:55 -08:00
Eli Uriegas
275851a755
Merge pull request #188 from webtic/master
...
Find URL encoded filenames on the fs by decoding them first
2016-12-24 18:14:45 -08:00
Eli Uriegas
16182472fa
Remove trailing whitespace
2016-12-24 18:11:46 -08:00
Eli Uriegas
29f3c22fed
Rework conditionals to not be inline
2016-12-24 18:11:12 -08:00
Eli Uriegas
a116666d55
Merge pull request #223 from r0fls/115
...
Raise error if response is malformed.
2016-12-24 17:12:17 -08:00
Raphael Deem
c2622511ce
Raise error if response is malformed. Issue #115
2016-12-24 17:09:41 -08:00
cr0hn
cc982c5a61
Update response.py
...
Type check by isinstance
2016-12-24 15:24:25 +01:00
38elements
2d05243c4a
Refactor arguments of run function
2016-12-24 22:49:48 +09:00
38elements
39211f8fbd
Refactor arguments of serve function
2016-12-24 11:40:07 +09:00
Raphael Deem
32ea45d403
allow overriding logging.basicConfig
2016-12-23 16:17:34 -08:00
cr0hn
5afae986a0
Apply response Middleware always
...
Response middleware are useful to apply some post-process information, just before send to the user. For example: Add some HTTP headers (security headers, for example), remove "Server" banner (for security reasons) or cookie management.
The change is very very simple: although an "request" middleware has produced any response, we'll even apply the response middlewares.
2016-12-23 15:59:04 +01:00
cr0hn
f091d82bad
Improvement
...
improvement: support fo binary data as a input. This do that the response process has more performance because not encoding needed.
2016-12-23 13:12:59 +01:00
Stefano Palazzo
a73a7d1e7b
Make it possible to disable the logo by subclassing Config
2016-12-23 11:42:00 +01:00
38elements
c657c531b4
Customizable protocol
2016-12-23 00:13:38 +09:00
38elements
75fc9f91b9
Change HttpParserError process
2016-12-18 09:25:39 +09:00
Tim Mundt
ef9edfd160
added documentation for configuration
2016-12-17 20:20:07 +01:00
Tim Mundt
234a7925c6
restored accidentally degraded doc string
2016-12-17 19:24:41 +01:00
Tim Mundt
a550b5c112
added tests and small fixes for config
2016-12-16 18:46:07 +01:00
Tim Mundt
04798cbf5b
added methods to load config from a file
2016-12-16 17:05:09 +01:00
Eli Uriegas
435d5585e9
Fix leftover blank line
...
flake8 build failed here: https://travis-ci.org/channelcat/sanic/builds/183991976
2016-12-14 11:29:09 -06:00
Eli Uriegas
ddfb7f2861
Merge branch 'master' into convert_dict_to_set
2016-12-14 11:26:31 -06:00
Paul Jongsma
2003eceba1
remove trailing space
2016-12-13 10:41:39 +01:00
Eli Uriegas
a3a14cdab2
Merge pull request #170 from jpiasetz/convert_lambda_to_partial
...
Convert server lambda to partial
2016-12-12 20:40:29 -06:00
Paul Jongsma
9ba2f99ea2
added a comment on why to decode the file_path
2016-12-13 01:10:24 +01:00
Paul Jongsma
0464d31a9c
Find URL encoded filenames on the fs by decoding them first
2016-12-10 12:16:37 +01:00
Eli Uriegas
e3453553e1
Merge pull request #183 from 38elements/payload-too-large
...
Change Payload Too Large process
2016-12-08 10:27:55 -06:00
Raphael Deem
457507d8dc
return 400 on invalid json post data
2016-12-07 20:40:31 -08:00
38elements
662e0c9965
Change Payload Too Large process
...
When Payload Too Large occurs, it uses error handler.
2016-12-04 10:50:32 +09:00
Jack Fischer
c34427690a
Merge branch 'master' of git://github.com/channelcat/sanic
2016-12-03 15:08:07 -05:00
Eli Uriegas
d8a974bb4f
Merge pull request #175 from Derrreks/master
...
Improving comments
2016-12-02 20:07:28 -06:00
Eli Uriegas
39f3a63ced
Increment version to 0.1.8
2016-11-29 15:59:03 -06:00
Eli Uriegas
89e2084489
Merge pull request #172 from 38elements/timeout
...
Change request timeout process
2016-11-29 15:56:07 -06:00
Derek Schuster
70c56b7db3
fixing line length
2016-11-28 14:22:07 -05:00
Derek Schuster
209b763302
fix typo
2016-11-28 14:05:47 -05:00
Derek Schuster
190b7a6076
improving comments and examples
2016-11-28 14:00:39 -05:00
Eli Uriegas
cce47a633a
Merge pull request #167 from AntonDnepr/class-based-views
...
Class based views
2016-11-27 21:33:46 -06:00
Jack Fischer
0c215685f2
refactoring cookies
2016-11-27 08:30:46 -05:00
Jack Fischer
d86ac5e3e0
fix for cookie header capitalization bug
2016-11-26 11:20:29 -05:00
38elements
ee89b6ad03
before process
2016-11-26 16:47:16 +09:00
38elements
a5e6d6d2e8
Use default error process
2016-11-26 16:02:44 +09:00
Anton Zhyrney
1eea1f5485
rename&remove redundant code
2016-11-26 08:45:08 +02:00
38elements
0bd61f6a57
Use write_response
2016-11-26 14:14:30 +09:00
38elements
c01cbb3a8c
Change Request timeout process
...
This add a request timeout exception.
It cancels task, when request is timeout.
2016-11-26 13:55:45 +09:00
John Piasetzki
0ca5c4eeff
Use explicit import for httptools
...
Explicit importing the parser and the exception to save a name lookup.
2016-11-25 15:14:44 -05:00
John Piasetzki
47927608b2
Convert connections dict to set
...
Connections don't need to be a dict since the value is never used
2016-11-25 15:14:19 -05:00
John Piasetzki
13808bf282
Convert server lambda to partial
...
Partials are faster then lambdas for repeated calls.
2016-11-25 15:13:58 -05:00
Anton Zhyrney
c3c7964e2e
pep8 fixes
2016-11-25 09:29:25 +02:00
Anton Zhyrney
9f2d73e2f1
class based views implementation for sanic
2016-11-25 09:10:25 +02:00
Eli Uriegas
fc19f2ea34
Merge pull request #163 from channelcat/request-data-vars
...
Access Request like a dictionary
Closes #129 #132
2016-11-23 13:51:17 -06:00
Eli Uriegas
93f50b8ef7
Merge pull request #160 from jiajunhuang/log
...
fix the way using logging.exception
2016-11-21 10:37:10 -06:00
abhishek7
f7f578ed44
Fixed Exception error log on line 157 of server.py
2016-11-20 21:37:01 -05:00
Channel Cat
d02fffb6b8
Fixing import of CIMultiDict
2016-11-19 18:41:40 -08:00
Channel Cat
993627ec44
Merged with master
2016-11-19 18:21:44 -08:00
Channel Cat
3ce6434532
Fix flake8
2016-11-19 18:04:35 -08:00
Channel Cat
a97e554f8f
Added shared request data
2016-11-19 17:48:28 -08:00
Raphael Deem
635921adc7
Update headers to use CIMultiDict instead of dict
2016-11-19 16:09:38 -08:00
jiajunhuang
9eb4cecbc1
fix the way using logging.exception
2016-11-19 15:19:38 +08:00
Raphael Deem
f16ea20de5
provide default app name
2016-11-18 17:16:48 -08:00
Eli Uriegas
edb12da154
Fix the flake8 error caused by new flake8 version
2016-11-16 12:55:13 -06:00
Eli Uriegas
b51af7f4bf
Merge pull request #147 from webtic/master
...
Add the client address to the request header
2016-11-10 15:30:04 -06:00
Eli Uriegas
28ce2447ef
Update variable name
...
Give `ra` a more explicit name
2016-11-10 15:28:16 -06:00
Paul Jongsma
8ebc92c236
pass flake8 tests
2016-11-10 13:09:37 +01:00
Paul Jongsma
b92e46df40
fix whitespace
2016-11-10 13:06:27 +01:00
Paul Jongsma
be5588d5d8
Add the client address to the request header
2016-11-10 12:53:00 +01:00
Pahaz Blinov
0d9fb2f927
docs(request): return value docstring
2016-11-09 18:04:15 +05:00
Pahaz Blinov
0e9819fba1
fix(request): parse_multipart_form should return RequestParameters
...
I have this code:
```
form = FileForm(request.files)
```
and it raise error because the `request.files` is `dict` but `RequestParameters` is expected =/
2016-11-09 00:36:37 +05:00
Pahaz Blinov
5efe51b661
fix(request.py): problem in case of request without content-type header ( #142 )
...
* fix(request.py): exception if access request.form on GET request
* fix(request): just make a unification (parsed_form and parsed_files) + RFC fixes
parsed_form and parsed_files must be a RequestParameters type in all cases!
2016-11-07 15:27:50 -06:00
Pahaz Blinov
1b65b2e0c6
fix(blueprints): @middleware IndexError ( #139 )
2016-11-06 10:08:55 -06:00
Eli Uriegas
1271c7d958
Merge pull request #128 from channelcat/keep-alive-timeout-fix
...
Keep alive timeout fix
2016-11-05 12:11:41 -06:00
Eli Uriegas
3a1ef6bef2
Merge pull request #125 from clenimar/fix-comments
...
Fix comments over-indentation
2016-11-03 08:27:39 -06:00
imbolc
3cd3b2d9b7
Fix upload without content-type
2016-11-03 12:34:55 +07:00
Marcin Baran
80fcacaf8b
Add loop kwargs to sanic_endpoint_test
2016-11-02 12:27:58 +01:00
Channel Cat
707c55fbe7
Fix flake8
2016-10-28 03:35:30 -07:00
Channel Cat
c44b5551bc
time.time faster than loop.time?
2016-10-28 03:13:03 -07:00
Channel Cat
bd28da0abc
Keep-alive requests stay open if communicating
2016-10-28 02:56:32 -07:00
Clenimar Filemon
f3fc958a0c
Fix comments over-indentation
2016-10-27 11:09:36 -03:00
Channel Cat
65950250d9
Merge pull request #111 from channelcat/reverse-static
...
Reverse static arguments
2016-10-25 02:52:21 -07:00
Channel Cat
74ae0007d3
Reverse static arguments
2016-10-25 02:45:28 -07:00
Channel Cat
977081f4af
Merge pull request #110 from channelcat/cookies-lazy-creation
...
Lazy cookie creation
2016-10-25 01:50:33 -07:00
Channel Cat
ee70f1e55e
Upped to version 0.1.6
2016-10-25 01:49:43 -07:00
Channel Cat
9c16f6dbea
Fix flake8 issues
2016-10-25 01:36:12 -07:00
Channel Cat
c50aa34dd9
Lazy cookie creation
2016-10-25 01:27:54 -07:00
Channel Cat
0e479d53da
Merge pull request #104 from channelcat/pr/101
...
Static file support
2016-10-24 22:42:01 -07:00
Channel Cat
53e00b2b4c
Added blueprint order test and used deques to add blueprints
2016-10-24 02:09:07 -07:00
Channel Cat
bf6879e46f
Made static file serving part of Sanic
...
Added sanic.static, blueprint.static, documentation, and testing
2016-10-24 01:21:06 -07:00
imbolc
d7fff12b71
Static middleware
2016-10-24 02:17:03 +07:00
pcdinh
5361c6f243
e is an unused variable. Safe to remove
2016-10-23 19:38:28 +07:00
pcdinh
963aef19e0
w is unused variable to it is safe to suppress Pylint warning using _
...
(underscore)
2016-10-23 19:36:08 +07:00
Channel Cat
47ec026536
Fix incomplete request body being read
2016-10-23 03:30:13 -07:00
Channel Cat
e70263d012
Merge pull request #87 from channelcat/blueprint-extras
...
Blueprint start/stop listeners + ordering
2016-10-23 02:04:55 -07:00
Channel Cat
41ea40fc35
increased server event handler type flexibility
2016-10-23 01:51:46 -07:00
Channel Cat
3802141007
Adding cookie capabilities for issue #74
2016-10-23 01:32:16 -07:00
Channel Cat
a5614f6880
Added server start/stop listeners and reverse ordering on response middleware to blueprints
2016-10-21 04:11:18 -07:00
Hyungtae Kim
c256825de6
Content Type of JSON response should not have a charset
2016-10-20 13:38:03 -07:00
Channel Cat
d4e2d94816
Added support for routes with / in custom regexes and updated lru to use url and method
2016-10-20 11:33:28 +00:00
John Piasetzki
f510550888
Fix flake8
2016-10-20 01:37:12 -04:00
John Piasetzki
fc4c192237
Add simple uri hash to lookup
2016-10-20 01:29:22 -04:00
John Piasetzki
f4b45deb7f
Convert dict to set
2016-10-20 00:28:05 -04:00
John Piasetzki
d1beabfc8f
Add lru_cache to get
2016-10-20 00:28:05 -04:00
John Piasetzki
baf1ce95b1
Refactor get
2016-10-20 00:28:05 -04:00
John Piasetzki
e25e1c0e4b
Convert string formats
2016-10-20 00:28:05 -04:00
John Piasetzki
04a6cc9416
Refactor add parameter
2016-10-20 00:28:05 -04:00
John Piasetzki
50e4dd167e
Extract constant
2016-10-19 23:43:31 -04:00
John Piasetzki
f2cc404d7f
Remove simple router
2016-10-19 23:41:22 -04:00
Ludovic Gasc (GMLudo)
7dcdc6208d
Enable after_start and before_stop callbacks for multiprocess
2016-10-20 01:01:51 +02:00
Ubuntu
3d00ca09b9
Added fast lookup dict for common response codes
2016-10-19 08:37:35 +00:00
Ubuntu
69345272cd
Merge branch 'feature/statuscode' of https://github.com/mikoim/sanic into mikoim-feature/statuscode
2016-10-19 08:26:11 +00:00
Channel Cat
2903e7ee7c
Merge pull request #65 from blakev/feature/expose-loop
...
Exposes `loop`in sanic `serve` and `run` functions (#64 )
2016-10-19 01:21:15 -07:00
Channel Cat
71a783e7e1
Merge pull request #59 from yishibashi/comment-fix
...
comment fixed
2016-10-18 21:14:10 -07:00
Channel Cat
c58741fe7a
Changed start failure to print exception
2016-10-18 16:50:14 -07:00
Eshin Kunishima
7b0f524fb3
Added HTTP status codes
...
Based on http.HTTPStatus
2016-10-19 01:53:11 +09:00
Blake VandeMerwe
5e459cb69d
Exposes loop
in sanic serve
and run
functions ( #64 )
2016-10-18 10:05:29 -06:00
yishibashi
7c3faea0dd
comment fixed
2016-10-18 19:32:47 +09:00
Channel Cat
4ecb4d2cce
Added newline to fix flake8 error
2016-10-18 01:38:50 -07:00
Channel Cat
c539933e38
Fixed unused import, added change log
2016-10-18 01:31:09 -07:00
Channel Cat
6f105a647e
Added multiprocessing
2016-10-18 01:22:49 -07:00
Channel Cat
18aa937f29
Fix slowdown
2016-10-17 23:34:07 -07:00
Channel Cat
73ef816d89
Merge pull request #45 from mindflayer/master
...
Fix for string tokens
2016-10-16 14:23:29 -07:00
Channel Cat
031a95e4d9
Merge pull request #39 from seemethere/fix_flake8_errors
...
Fix flake8 errors
2016-10-16 13:54:36 -07:00
Giorgio Salluzzo
2ee4c0fc6a
Merge branch 'master' of github.com:mindflayer/sanic
2016-10-16 22:42:06 +02:00
Giorgio Salluzzo
3e8b8fb46f
Fix for issue #44 .
2016-10-16 22:41:56 +02:00
abhishek7
3c7a8a5f45
Added some documentation to request.py, removed extra line in blueprints.py, and minor grammar enhancements to blueprints.md and middleware.md
2016-10-16 11:35:45 -04:00
Eli Uriegas
ea0a037248
Fix flake8 errors
2016-10-16 08:01:59 -05:00
Channel Cat
9d388e9933
Fixed flake8 errors
2016-10-16 02:21:24 -07:00
Channel Cat
d195db0fd3
merged
2016-10-16 09:01:39 +00:00
Channel Cat
40b1ec91f0
Added blueprint exception and middleware support, and tests
2016-10-16 01:48:51 -07:00
Channel Cat
9b716e97ee
Merge branch 'feature_blueprints' of https://github.com/narzeja/sanic into narzeja-feature_blueprints
2016-10-16 08:21:35 +00:00
Channel Cat
8e07edb211
Merge pull request #33 from channelcat/middleware-unreachable
...
Middleware unreachable
2016-10-16 01:14:50 -07:00
Channel Cat
41a1a72a95
Merge pull request #26 from radarhere/master
...
Fixed typos
2016-10-16 00:53:59 -07:00
Channel Cat
516f661a38
Removed unreachable code and old middleware class
2016-10-16 00:52:39 -07:00
narzeja
b19452a1a7
assert warning clarification and adding blueprint containers to app object
2016-10-16 06:48:49 +02:00
narzeja
d761c34e8b
basic blueprint functionality
2016-10-16 06:43:22 +02:00
narzeja
aaf571fae4
Blueprint support, with docs, example, and tests
2016-10-16 06:43:22 +02:00
Ubuntu
13ba8d7325
merged changes
2016-10-16 04:20:12 +00:00
Andrew Murray
e3a6262012
Fixed typos
2016-10-16 12:28:24 +11:00
b.khasanov
a464d1e0b2
fix double router initializing
2016-10-16 01:14:47 +03:00
Michael Lavers
9f824b048e
Introduce end-of-line normalization
2016-10-15 12:59:00 -07:00
John Piasetzki
dd249ca665
Use printf-style String Formatting for output
2016-10-15 14:58:31 -04:00
John Piasetzki
6a1f706387
Remove unused imports
2016-10-15 14:58:22 -04:00
Channel Cat
254861bc37
Reformatted code to use spaces instead of tabs
2016-10-14 19:53:49 -07:00
channelcat
67db0bcbf3
Merge pull request #4 from n1ywb/master
...
add http:// to server info message so it's clickable
2016-10-14 19:40:40 -07:00
Jeff Laughlin
ba5363ef43
add http:// to server info message so it's clickable
2016-10-14 18:50:41 -04:00
Eli Uriegas
4684083f2f
Move helpers from tests to sanic proper
2016-10-14 17:36:32 -05:00
Channel Cat
818826b4b0
Removed unnecessary log
2016-10-14 05:09:14 -07:00
Channel Cat
dbd11bf387
Reverting
2016-10-14 03:59:41 -07:00
Channel Cat
ec10d24ac6
Minor speed improvements
2016-10-14 03:57:48 -07:00
Channel Cat
62c1235f58
speed improvements
2016-10-14 03:52:21 -07:00
Channel Cat
33f712ef9b
Proper errors when server cannot bind
2016-10-14 03:42:20 -07:00
Channel Cat
a74ab9bd18
Added tests and middleware, and improved documentation
2016-10-14 03:23:48 -07:00
Channel Cat
49c499f44d
Added examples and form processing
2016-10-09 15:28:31 -07:00
Channel Cat
8fbc6c2c4e
Moved request handling into sanic
2016-10-08 19:45:11 -07:00
Channel Cat
b0d38f8a04
Performance degraded - added in request too large and keep-alive timeout
2016-10-08 17:27:10 -07:00
Channel Cat
fa980b1445
Performance improvements to url parsing
2016-10-08 16:04:18 -07:00
Channel Cat
6041e7cfa6
Performance improvements to response and moved tests around
2016-10-08 15:21:40 -07:00
Channel Cat
e8287df3e5
Fixed POST request getting JSON
2016-10-06 01:23:52 -07:00
Channel Cat
d40e750ce6
added on_start on_stop
2016-10-05 05:30:36 +00:00
Channel Cat
4489f536da
.
2016-10-03 00:45:59 -07:00
Channel Cat
fed5c01efb
fix 4watt
2016-10-03 00:38:53 -07:00
Channel Cat
ffd521b67b
derp
2016-10-03 00:35:20 -07:00
Channel Cat
ee98c8b42f
.
2016-10-03 07:27:54 +00:00
Channel Cat
7cdeff63f6
Decode data by default
2016-10-02 23:55:46 -07:00
Channel Cat
2ad7014666
Args should be an empty dict if none exist
2016-10-02 22:31:31 -07:00
Channel Cat
7ec5432f64
Fixed coroutine checking
2016-10-02 22:03:14 -07:00
Channel Cat
af2cf771d4
Added better debug info
2016-10-02 21:11:38 -07:00
Channel Cat
b59dc2729f
Added better error handling and coroutine checking
2016-10-02 20:47:15 -07:00
Channel Cat
e0b9260644
Sanic can now parse args and json
2016-10-02 18:45:44 -07:00
Channel Cat
0489526ac9
Fix crash
2016-10-02 17:32:27 -07:00
Channel Cat
8cc028764d
Fixed keep-alive header and broken connection handling
2016-10-02 02:18:41 +00:00
Channel Cat
a75986e357
Initial Commit
2016-05-25 21:52:42 -07:00