Adam Hopkins
040468755c
Change ASCII Logo
...
Update logo text
Reformat app.py
2018-12-30 12:49:23 +02:00
Harsha Narayana
09678d601d
add sanic app module documentations
...
Signed-off-by: Harsha Narayana <harsha2k4@gmail.com>
2018-12-28 10:22:27 +05:30
Yun Xu
1bfbc67c62
expose request_buffer_queue_size to be configurable and update documentation
...
fix StreamBuffer buffer_size
2018-12-04 20:21:00 -08:00
Andres Sanchez
7c182f63c8
Indentation fix
2018-11-01 10:59:45 -06:00
Andres Sanchez
b70176f8c7
Fixed character limit per line in requested changes for app.py
2018-11-01 10:36:34 -06:00
Andres Sanchez
e63d0091af
Assert was chnaged for an if and updated error messages
2018-10-31 15:23:29 -06:00
Andres Sanchez
7b0af2d80d
Handle loop exception in app.py
2018-10-31 13:35:03 -06:00
Adam Hopkins
c708e8425f
Fix documentation build errors
2018-10-26 11:57:28 +03:00
Yun Xu
0505aa2dda
refactor import
2018-10-23 14:53:39 -07:00
Yun Xu
8ef7bf8e7b
integrate with isort
2018-10-17 21:20:16 -07:00
Yun Xu
aa9bf04dfe
run black against sanic module
2018-10-13 17:55:33 -07:00
Colin Caine
bcc11fa7fe
Fix whitespace in error message
2018-09-30 09:36:55 +01:00
Eli Uriegas
6f813f940e
Merge pull request #1278 from ashleysommer/graceful_cancel
...
Gracefully handle when the request_handler_task is cancelled.
2018-08-17 11:41:39 -07:00
hqy
6abdf9f9c1
fixed #1143 ( #1276 )
...
* fixed #1143
* fixed build failed with create_serve call _helper failed
2018-08-15 10:23:04 -07:00
abuckenheimer
212da1029e
disabled auto_reload by default in windows ( #1280 )
2018-08-07 11:48:18 -07:00
Ashley Sommer
39ff02b6e4
Modifications the handle_request
function to detect and gracefully handle the case that the request_handler Task is canceled by the sanic server while it is handling the request. One common occurrence of this is when the server issues a ResponseTimeout error, it also cancels the response_handler Task.
...
The Canceled exception handler purposely sets `response` to `None` to drop references to the handler coroutine, in an attempt to preemptively release resources.
This commit also fixes a possible reference-before-assignment of the `response` variable in the `handle_request` function.
Finally, another byproduct of this change is that ResponseMiddleware will no longer run if the `response` is `None`.
2018-08-06 14:12:30 +10:00
Cosmo Borsky
b238be54a4
Add content_type flag to Sanic.static ( #1267 )
...
* Add content_type flag to Sanic.static
Fixes #1266
* Fix flake8 error in travis
Add line to document `content_type` arg
* Fix content_type for file streams
Update tests
herp derp
* Remove content_type as an arg to HTTPResponse
`response.HTTPResponse` will default to `headers['Content-Type']` instead of `content_type`
https://github.com/channelcat/sanic/pull/1267#discussion_r204190913
2018-07-20 22:31:15 -07:00
ciscorn
599834b0e1
Add subprotocols param to add_websocket_route ( #1261 )
2018-07-16 12:20:26 -07:00
Philip Xu
2f30f4f69f
Fixed #1231 - release resource no matter what ( #1232 )
2018-06-06 14:43:57 -07:00
Raphael Deem
8f2d543d9f
default to auto_reload in debug mode ( #1159 )
...
* default to auto_reload in debug mode
* disable auto-reload in testing client
2018-04-01 20:52:56 -07:00
Kinware
915d2732a1
Allow streaming handlers in add_route
2018-03-12 20:21:59 +01:00
Raphael Deem
7e4a9e3bc2
Merge pull request #1047 from Yaser-Amiri/master
...
Add auto reloading.
2018-02-16 11:11:49 -08:00
Raphael Deem
36f12c822f
Merge pull request #1122 from knowsuchagency/master
...
add app.register_listener method
2018-02-15 16:58:27 -08:00
Stephan Fitzpatrick
1d75f6c2be
changed docstring spacing
2018-02-13 10:15:16 -08:00
Yun Xu
0fe0796870
expose websocket protocol arguments
2018-02-09 20:44:02 -08:00
Stephan Fitzpatrick
571b5b544d
added app.register_listener method w/test
2018-02-09 14:01:17 -08:00
NyanKiyoshi
285ad9bdc1
No longer raising a missing parameter when value is null
...
When passing a null value as parameter (ex.: 0, None or False), Sanic said "Error: Required parameter `param` was not passed to url_for"
Example:
```
@app.route("/<idx>")
def route(rq, idx):
pass
```
```
url_for("route", idx=0)
```
No longer raises: `Error: Required parameter `idx` was not passed to url_for`
2018-01-26 21:13:43 +01:00
howie6879
6c0fbef843
Add parameter check
2018-01-24 08:17:55 +08:00
howie6879
040c85a43b
Add parameter check
2018-01-24 08:11:47 +08:00
howie6879
f20b854dd2
Add parameter check
2018-01-22 14:52:30 +08:00
howie6879
3844cec7a4
Add parameter check
2018-01-22 14:12:41 +08:00
Raphael Deem
22ad697d1f
Merge pull request #1078 from eltrhn/master
...
Add support for blueprint groups and nesting
2018-01-18 17:26:52 -08:00
Eli
a10d7469cd
Add blueprint groups + nesting
2018-01-18 17:20:51 -08:00
r0fls
7a1dab3319
fix exception handling
2018-01-05 14:12:22 -08:00
Raphael Deem
a1ffc6d55b
try to inject the app in add_task method
2017-12-27 01:06:43 -08:00
Yaser Amiri
81494453b0
Remove dependency on requests library.
...
Change auto reloader enviroment varible name to SANIC_SERVER_RUNNING
Fix some typo mistakes, flake uncompatibilities and such problems.
Raise NotImplementedError for operating systems except posix systems for auto reloading.
2017-12-26 19:17:13 +03:30
Raphael Deem
8e3f3977bd
allow add_task after server starts
2017-12-21 23:37:42 -08:00
Raphael Deem
72254a7af9
Merge pull request #1054 from r0fls/rfc7231
...
fix issues with method not allowed response
2017-12-13 23:42:37 -08:00
Raphael Deem
2b0258c13a
fix issues with method not allowed response
2017-12-11 20:12:26 -08:00
Yaser Amiri
3fe3c2c79f
Add test for auto reloading.
2017-12-07 20:19:40 +03:30
Yaser Amiri
52c2a8484e
Add auto reloader.
2017-12-07 16:30:54 +03:30
Edward Betts
cfc75b4f1a
Correct spelling mistakes.
2017-11-15 15:46:39 +00:00
Raphael Deem
979b5a52d3
Merge pull request #1005 from joar/feature/static-strict-slashes
...
Add strict_slashes to {app, blueprint}.static()
2017-11-07 07:49:32 -08:00
Gaetan Semet
49b1d667f1
Optionalize app.run dictConfig ( fix #1000 )
...
Signed-off-by: Gaetan Semet <gaetan@xeberon.net>
2017-11-04 15:58:27 +01:00
Joar Wandborg
ca596c8ecd
Add strict_slashes to {Sanic, Blueprint}().static()
2017-11-02 15:44:36 +01:00
Raphael Deem
63bbcb5152
Merge branch 'master' into 977
2017-10-25 22:18:25 -07:00
Raphael Deem
5bf722c7ae
remove bare exceptions
2017-10-25 21:58:31 -07:00
Raphael Deem
9150767574
add blueprint name to request.endpoint
2017-10-16 23:25:37 -07:00
Raphael Deem
75f2180cb1
add handler name to request as endpoint
2017-10-16 22:43:40 -07:00
pcinkh
6d2f5da506
Speedup websocket disconnects.
2017-10-11 14:02:26 +03:00
Yun Xu
225ea49b6f
resolve conflicts again
2017-10-01 01:22:27 -07:00
Raphael Deem
15fd49037f
Merge pull request #939 from ashleysommer/keepalive_timeout
...
Split RequestTimeout, ResponseTimeout, and KeepAliveTimeout into different timeouts
2017-09-30 22:15:50 -07:00
Raphael Deem
9aec5febb8
support vhosts in static routes
2017-09-27 01:24:49 -07:00
lixxu
f96ab02767
set scheme to http if not provided
2017-09-27 09:59:49 +08:00
Yun Xu
0b23f4ff81
resolve conflicts
2017-09-23 06:19:09 -07:00
Yun Xu
5ee7b6caeb
fixing small issue
2017-09-13 10:35:34 -07:00
Yun Xu
24bdb1ce98
add unit tests/refactoring
2017-09-12 23:42:42 -07:00
Yun Xu
a46e004f07
apply new loggers
2017-09-11 22:12:49 -07:00
Ashley Sommer
2979e03148
WIP - Split RequestTimeout, ResponseTimout, and KeepAliveTimeout into different timeouts, with different callbacks.
2017-09-11 17:17:33 +10:00
Yun Xu
c9cbc00e36
use access_log as param
2017-09-10 18:38:52 -07:00
Yun Xu
c9a40c180a
remove some logging stuff
2017-09-10 11:11:16 -07:00
lixxu
bc20dc5c62
use url_for for url building for static files
2017-09-06 19:17:52 +08:00
lixxu
eab809d410
add name option for route building
2017-08-21 18:05:34 +08:00
Yun Xu
ef81a9f547
make strict_slashes default value configurable
2017-08-20 23:11:38 -07:00
Raphael Deem
df4a149cd0
Merge pull request #885 from yunstanford/master
...
add triggers events when async create_server
2017-08-09 15:59:44 -07:00
Yun Xu
80f27b1db9
add unit tests and make flake8 happy
2017-08-08 22:21:40 -07:00
Yun Xu
d5d1d3b45a
add trigger before_start events in create_server
2017-08-08 21:58:10 -07:00
Miguel Grinberg
375ed23216
Weboscket subprotocol negotiation
...
Fixes #874
2017-08-08 11:40:44 -07:00
zyguan
918e2ba8d0
Revert "fix #752 "
...
This reverts commit 599fbcee6e
.
2017-07-24 11:53:11 +08:00
Raphael Deem
4265ad5f23
add versioning
2017-07-12 22:19:42 -07:00
Yun Xu
d812affef0
add graceful_shutdown_timeout to gunicorn worker
2017-06-25 00:51:14 -07:00
Eran Kampf
77cf0b678a
Fix has_log value
2017-06-15 11:21:08 -07:00
Eran Kampf
2dfb061063
Prevent run
from overriding logging config set in constructor
...
When creating the `Sanic` instance I provide it with a customized `log_config`.
Calling `run` overrides these settings unless I provide it *again* with the same `log_config`.
This is confusing and error prone. `run` shouldnt override configurations set in the `Sanic` constructor...
2017-06-15 10:39:00 -07:00
Raphael Deem
599fbcee6e
fix #752
2017-06-11 23:20:04 -07:00
messense
0024edbbb9
Add websocket max_size and max_queue configuration
2017-05-26 11:15:28 +08:00
Eli Uriegas
48de321869
Merge pull request #697 from 38elements/stream
...
Add Request.stream
2017-05-24 16:22:52 -07:00
Raphael Deem
c6d68009d2
Merge pull request #745 from messense/feature/gunicorn-worker-test-case
...
Add a simple integration test for Gunicorn worker
2017-05-23 20:53:01 -07:00
Raphael Deem
2cab267405
Merge pull request #734 from ashleysommer/static_large_file_stream
...
Add option to static helper to use streaming for large files.
2017-05-23 20:52:12 -07:00
messense
6bdc0d2e5e
Fix Gunicorn worker
2017-05-23 11:28:12 +08:00
Raphael Deem
b447807b36
Merge pull request #742 from r0fls/700
...
changes required for unix socket support
2017-05-22 19:29:32 -07:00
Raphael Deem
52b0254ec6
unix socket support; fixes #700
2017-05-21 03:15:06 -07:00
Raphael Deem
49631542ce
Merge pull request #732 from jrocketfingers/feature/explicit-register-middleware
...
Extract register_middleware into a method.
2017-05-21 03:06:12 -07:00
ashleysommer
72db1188c7
Add an option to the static() helper to switch on streaming for large files.
...
By default uses a 1M threshold.
ie. if the static file to serve is >= 1M it will stream the file.
This threshold value is configurable by passing an int instead of a bool to `stream_large_files` parameter of `static()`.
2017-05-20 09:56:05 +10:00
Johnny Rocketfingers
3f841f3b21
Switch to non-hardcoded register_middleware.
2017-05-18 22:08:44 +02:00
Johnny Rocketfingers
bf5438d573
Extract register_middleware into a method.
2017-05-18 06:36:11 +02:00
messense
2f84cdd708
Fix websocket handler bug on Python3.5 with no uvloop
2017-05-17 12:12:25 +08:00
38elements
6a14e49479
Replace stream decorator to stream parameter
2017-05-09 22:31:15 +09:00
38elements
4d4f38fb35
is_request_stream for CompositionView and HTTPMethodView
2017-05-09 01:04:03 +09:00
38elements
ef2cc7ebf5
Add Request.stream
2017-05-07 18:38:48 +09:00
38elements
e12c10b087
Remove loop argument in run() and create_server()
2017-05-03 17:52:19 +09:00
38elements
0a2c95cc10
Remove before_start, before_stop, after_start and after_stop
2017-05-02 23:07:09 +09:00
Eli Uriegas
c35721abbd
Merge pull request #670 from ticosax/set-exit-code-on-error
...
In case of error when starting sanic
2017-05-01 15:16:02 -07:00
banteg
7754bb995b
expose matched request uri template
2017-04-29 02:39:56 +07:00
Nicolas Delaby
d1fefce61c
fixup! In case of error when starting sanic
2017-04-28 20:06:44 +02:00
Nicolas Delaby
8b13e103fd
In case of error when starting sanic
...
Don't exit with code 0
2017-04-28 19:08:51 +02:00
Raphael Deem
74cc7be922
Merge branch 'master' into master
2017-04-24 00:47:01 -07:00
Raphael Deem
b3814ca89a
Merge pull request #646 from r0fls/637
...
allow disabling keep alive
2017-04-24 00:43:16 -07:00
38elements
bc035fca78
Remove unnecessary variables
2017-04-20 18:27:28 +09:00
38elements
df914a92e4
Fix this.signal.stopped
is True
#639
2017-04-19 11:19:01 +09:00
Raphael Deem
81b6d988ec
NO_KEEP_ALIVE -> KEEP_ALIVE
2017-04-16 22:43:49 -07:00