Merge remote-tracking branch 'upstream/master'
This commit is contained in:
commit
e148b50d6a
|
@ -59,6 +59,13 @@ Installation
|
|||
|
||||
- ``python -m pip install sanic``
|
||||
|
||||
To install sanic without uvloop or json using bash, you can provide either or both of these environmental variables
|
||||
using any truthy string like `'y', 'yes', 't', 'true', 'on', '1'` and setting the NO_X to true will stop that features
|
||||
installation.
|
||||
|
||||
- ``SANIC_NO_UVLOOP=true SANIC_NO_UJSON=true python -m pip install sanic``
|
||||
|
||||
|
||||
Documentation
|
||||
-------------
|
||||
|
||||
|
|
|
@ -5,7 +5,7 @@ both read and write cookies, which are stored as key-value pairs.
|
|||
|
||||
## Reading cookies
|
||||
|
||||
A user's cookies can be accessed `Request` object's `cookie` dictionary.
|
||||
A user's cookies can be accessed via the `Request` object's `cookies` dictionary.
|
||||
|
||||
```python
|
||||
from sanic.response import text
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
import os
|
||||
|
||||
import types
|
||||
|
||||
SANIC_PREFIX = 'SANIC_'
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
from mimetypes import guess_type
|
||||
from os import path
|
||||
|
||||
try:
|
||||
from ujson import dumps as json_dumps
|
||||
except:
|
||||
|
|
37
setup.py
37
setup.py
|
@ -4,8 +4,10 @@ Sanic
|
|||
import codecs
|
||||
import os
|
||||
import re
|
||||
from setuptools import setup
|
||||
from distutils.errors import DistutilsPlatformError
|
||||
from distutils.util import strtobool
|
||||
|
||||
from setuptools import setup
|
||||
|
||||
with codecs.open(os.path.join(os.path.abspath(os.path.dirname(
|
||||
__file__)), 'sanic', '__init__.py'), 'r', 'latin1') as fp:
|
||||
|
@ -35,23 +37,32 @@ setup_kwargs = {
|
|||
],
|
||||
}
|
||||
|
||||
try:
|
||||
normal_requirements = [
|
||||
ujson = 'ujson>=1.35'
|
||||
uvloop = 'uvloop>=0.5.3'
|
||||
|
||||
requirements = [
|
||||
'httptools>=0.0.9',
|
||||
'uvloop>=0.5.3',
|
||||
'ujson>=1.35',
|
||||
uvloop,
|
||||
ujson,
|
||||
'aiofiles>=0.3.0',
|
||||
'websockets>=3.2',
|
||||
]
|
||||
setup_kwargs['install_requires'] = normal_requirements
|
||||
]
|
||||
if strtobool(os.environ.get("SANIC_NO_UJSON", "no")):
|
||||
print("Installing without uJSON")
|
||||
requirements.remove(ujson)
|
||||
|
||||
if strtobool(os.environ.get("SANIC_NO_UVLOOP", "no")):
|
||||
print("Installing without uvLoop")
|
||||
requirements.remove(uvloop)
|
||||
|
||||
try:
|
||||
setup_kwargs['install_requires'] = requirements
|
||||
setup(**setup_kwargs)
|
||||
except DistutilsPlatformError as exception:
|
||||
windows_requirements = [
|
||||
'httptools>=0.0.9',
|
||||
'aiofiles>=0.3.0',
|
||||
'websockets>=3.2',
|
||||
]
|
||||
setup_kwargs['install_requires'] = windows_requirements
|
||||
requirements.remove(ujson)
|
||||
requirements.remove(uvloop)
|
||||
print("Installing without uJSON or uvLoop")
|
||||
setup_kwargs['install_requires'] = requirements
|
||||
setup(**setup_kwargs)
|
||||
|
||||
# Installation was successful
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
from sanic import Sanic
|
||||
from sanic.response import text
|
||||
from sanic.exceptions import PayloadTooLarge
|
||||
from sanic.response import text
|
||||
|
||||
|
||||
def test_payload_too_large_from_error_handler():
|
||||
|
|
Loading…
Reference in New Issue
Block a user