API: aj.api.http¶
-
class
aj.api.http.BaseHttpHandler[source]¶ Base class for everything that can process HTTP requests
-
handle(http_context)[source]¶ Should create a HTTP response in the given
http_contextand return the plain outputParameters: http_context ( aj.http.HttpContext) – HTTP context
-
-
class
aj.api.http.HttpMasterMiddleware(context)[source]¶ -
handle(http_context)[source]¶ Should create a HTTP response in the given
http_contextand return the plain outputParameters: http_context ( aj.http.HttpContext) – HTTP context
-
-
class
aj.api.http.HttpMiddleware(context)[source]¶ -
handle(http_context)[source]¶ Should create a HTTP response in the given
http_contextand return the plain outputParameters: http_context ( aj.http.HttpContext) – HTTP context
-
-
class
aj.api.http.HttpPlugin(context)[source]¶ A base interface for HTTP request handling:
@component class HelloHttp(HttpPlugin): @get('/hello/(?P<name>.+)') def get_page(self, http_context, name=None): context.add_header('Content-Type', 'text/plain') context.respond_ok() return 'Hello, f"{name}"!'
-
handle(http_context)[source]¶ Finds and executes the handler for given request context (handlers were methods decorated with
url()and will be decorated with e.g. @get and @post in the future)Parameters: http_context ( aj.http.HttpContext) – HTTP contextReturns: reponse data
-
-
class
aj.api.http.SocketEndpoint(context)[source]¶ Base interface for Socket.IO endpoints.
-
plugin= None¶ arbitrary plugin ID for socket message routing
-
-
aj.api.http.delete(pattern)¶ Exposes the decorated method of your
HttpPluginvia HTTPParameters: pattern (str) – URL regex ( ^and$are implicit)Return type: function Named capture groups will be fed to function as
**kwargs
-
aj.api.http.get(pattern)¶ Exposes the decorated method of your
HttpPluginvia HTTPParameters: pattern (str) – URL regex ( ^and$are implicit)Return type: function Named capture groups will be fed to function as
**kwargs
-
aj.api.http.head(pattern)¶ Exposes the decorated method of your
HttpPluginvia HTTPParameters: pattern (str) – URL regex ( ^and$are implicit)Return type: function Named capture groups will be fed to function as
**kwargs
-
aj.api.http.patch(pattern)¶ Exposes the decorated method of your
HttpPluginvia HTTPParameters: pattern (str) – URL regex ( ^and$are implicit)Return type: function Named capture groups will be fed to function as
**kwargs
-
aj.api.http.post(pattern)¶ Exposes the decorated method of your
HttpPluginvia HTTPParameters: pattern (str) – URL regex ( ^and$are implicit)Return type: function Named capture groups will be fed to function as
**kwargs
-
aj.api.http.put(pattern)¶ Exposes the decorated method of your
HttpPluginvia HTTPParameters: pattern (str) – URL regex ( ^and$are implicit)Return type: function Named capture groups will be fed to function as
**kwargs
-
aj.api.http.requests_decorator_generator(method)[source]¶ Factorization to generate request decorators like @get or @post.
Parameters: method (basestring) – Request method decorator to generate, like get or post Returns: Return type:
-
aj.api.http.url(pattern)[source]¶ Exposes the decorated method of your
HttpPluginvia HTTP. Will be deprecated in favor of new decorators ( @get, @post, … )Parameters: pattern (str) – URL regex ( ^and$are implicit)Return type: function Named capture groups will be fed to function as
**kwargs