Skip to content

Commit

Permalink
Merge branch 'main' into zhiwei/asgi-header-decode
Browse files Browse the repository at this point in the history
  • Loading branch information
ahopkins authored Mar 20, 2023
2 parents 9483af8 + 71cd53b commit f792bf0
Show file tree
Hide file tree
Showing 16 changed files with 694 additions and 62 deletions.
35 changes: 35 additions & 0 deletions sanic/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,30 @@
from sanic.app import Sanic
from sanic.blueprints import Blueprint
from sanic.constants import HTTPMethod
from sanic.exceptions import (
BadRequest,
ExpectationFailed,
FileNotFound,
Forbidden,
HeaderNotFound,
InternalServerError,
InvalidHeader,
MethodNotAllowed,
NotFound,
RangeNotSatisfiable,
SanicException,
ServerError,
ServiceUnavailable,
Unauthorized,
)
from sanic.request import Request
from sanic.response import (
HTTPResponse,
empty,
file,
html,
json,
raw,
redirect,
text,
)
Expand All @@ -17,16 +34,34 @@

__all__ = (
"__version__",
# Common objects
"Sanic",
"Blueprint",
"HTTPMethod",
"HTTPResponse",
"Request",
"Websocket",
# Common exceptions
"BadRequest",
"ExpectationFailed",
"FileNotFound",
"Forbidden",
"HeaderNotFound",
"InternalServerError",
"InvalidHeader",
"MethodNotAllowed",
"NotFound",
"RangeNotSatisfiable",
"SanicException",
"ServerError",
"ServiceUnavailable",
"Unauthorized",
# Common response methods
"empty",
"file",
"html",
"json",
"raw",
"redirect",
"text",
)
6 changes: 6 additions & 0 deletions sanic/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,7 @@
from sanic.touchup import TouchUp, TouchUpMeta
from sanic.types.shared_ctx import SharedContext
from sanic.worker.inspector import Inspector
from sanic.worker.loader import CertLoader
from sanic.worker.manager import WorkerManager


Expand Down Expand Up @@ -139,6 +140,7 @@ class Sanic(StaticHandleMixin, BaseSanic, StartupMixin, metaclass=TouchUpMeta):
"_test_client",
"_test_manager",
"blueprints",
"certloader_class",
"config",
"configure_logging",
"ctx",
Expand Down Expand Up @@ -181,6 +183,7 @@ def __init__(
loads: Optional[Callable[..., Any]] = None,
inspector: bool = False,
inspector_class: Optional[Type[Inspector]] = None,
certloader_class: Optional[Type[CertLoader]] = None,
) -> None:
super().__init__(name=name)
# logging
Expand Down Expand Up @@ -215,6 +218,9 @@ def __init__(
self.asgi = False
self.auto_reload = False
self.blueprints: Dict[str, Blueprint] = {}
self.certloader_class: Type[CertLoader] = (
certloader_class or CertLoader
)
self.configure_logging: bool = configure_logging
self.ctx: Any = ctx or SimpleNamespace()
self.error_handler: ErrorHandler = error_handler or ErrorHandler()
Expand Down
Loading

0 comments on commit f792bf0

Please sign in to comment.