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