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
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