swh.core.api.negotiation module

exception swh.core.api.negotiation.FormatterNotFound[source]

Bases: Exception

class swh.core.api.negotiation.Formatter(request_mimetype: Optional[str] = None)[source]

Bases: object

format: Optional[str] = None
mimetypes: List[str] = []
configure() → None[source]
render(obj: Any) → bytes[source]
class swh.core.api.negotiation.Negotiator(func: Callable[[], Any])[source]

Bases: object

register_formatter(formatter: Type[swh.core.api.negotiation.Formatter], *args, **kwargs) → None[source]
get_formatter(format: Optional[str] = None, mimetype: Optional[str] = None)swh.core.api.negotiation.Formatter[source]
property accept_mimetypes
best_mimetype() → str[source]
swh.core.api.negotiation.negotiate(negotiator_cls: Type[swh.core.api.negotiation.Negotiator], formatter_cls: Type[swh.core.api.negotiation.Formatter], *args, **kwargs) → Callable[source]