This module defines interfaces for requests and responses used in Connexion for authentication, validation, serialization, etc.

Module Contents



Connexion interface for a request.


Connexion interface for a response.


Wraps starlette Request so it can easily be extended.


Wraps starlette StreamingResponse so it can easily be extended.

class connexion.lifecycle.ConnexionRequest(url, method, path_params=None, query=None, headers=None, form=None, body=None, json_getter=None, files=None, context=None, cookies=None)

Connexion interface for a request.

property json(self)
class connexion.lifecycle.ConnexionResponse(status_code=200, mimetype=None, content_type=None, body=None, headers=None, is_streamed=False)

Connexion interface for a response.

class connexion.lifecycle.MiddlewareRequest(*args, **kwargs)

Bases: starlette.requests.Request

Wraps starlette Request so it can easily be extended.

__slots__ = []

A Mapping is a generic container for associating key/value pairs.

This class provides concrete generic implementations of all methods except for __getitem__, __iter__, and __len__.

property context(self)
property method(self) str
property receive(self) starlette.types.Receive
async stream(self) AsyncGenerator[bytes, None]
async body(self) bytes
async json(self) Any
async form(self) starlette.datastructures.FormData
async close(self) None
async is_disconnected(self) bool
async send_push_promise(self, path: str) None
__getitem__(self, key: str) Any
__iter__(self) Iterator[str]
__len__(self) int
property app(self) Any
property url(self) starlette.datastructures.URL
property base_url(self) starlette.datastructures.URL
property headers(self) starlette.datastructures.Headers
property query_params(self) starlette.datastructures.QueryParams
property path_params(self) Dict[str, Any]
property cookies(self) Dict[str, str]
property client(self) Optional[starlette.datastructures.Address]
property session(self) dict
property auth(self) Any
property user(self) Any
property state(self) starlette.datastructures.State
url_for(self, name: str, **path_params: Any) str
get(self, key, default=None)

D.get(k[,d]) -> D[k] if k in D, else d. d defaults to None.

__contains__(self, key)

D.keys() -> a set-like object providing a view on D’s keys


D.items() -> a set-like object providing a view on D’s items


D.values() -> an object providing a view on D’s values

classmethod __subclasshook__(cls, C)

Abstract classes can override this to customize issubclass().

This is invoked early on by abc.ABCMeta.__subclasscheck__(). It should return True, False or NotImplemented. If it returns NotImplemented, the normal algorithm is used. Otherwise, it overrides the normal algorithm (and the outcome is cached).

class connexion.lifecycle.MiddlewareResponse(content: ContentStream, status_code: int = 200, headers: Optional[Mapping[str, str]] = None, media_type: Optional[str] = None, background: Optional[starlette.background.BackgroundTask] = None)

Bases: starlette.responses.StreamingResponse

Wraps starlette StreamingResponse so it can easily be extended.

body_iterator :AsyncContentStream
charset = utf-8
async listen_for_disconnect(self, receive: starlette.types.Receive) None
async stream_response(self, send: starlette.types.Send) None
async __call__(self, scope: starlette.types.Scope, receive: starlette.types.Receive, send: starlette.types.Send) None
render(self, content: Any) bytes
init_headers(self, headers: Optional[Mapping[str, str]] = None) None
property headers(self) starlette.datastructures.MutableHeaders