Files
deb-python-falcon/falcon/media/base.py
Kurt Griffiths b51d4e9a35 feat(Request): Add support for several proxy "forwarded" headers (#1083)
Add support for some "forwarded" headers, included several new
attributes and a reworking of some of the existing code to better
facilitate sharing and performance.

Also clean up a couple tiny nits in the docstrings for the sake of
consistency.
2017-07-17 16:43:06 -05:00

31 lines
729 B
Python

import abc
import six
@six.add_metaclass(abc.ABCMeta)
class BaseHandler(object):
"""Abstract Base Class for an internet media type handler"""
@abc.abstractmethod # pragma: no cover
def serialize(self, obj):
"""Serialize the media object on a :any:`falcon.Response`
Args:
obj (object): A serializable object.
Returns:
bytes: The resulting serialized bytes from the input object.
"""
@abc.abstractmethod # pragma: no cover
def deserialize(self, raw):
"""Deserialize the :any:`falcon.Request` body.
Args:
raw (bytes): Input bytes to deserialize
Returns:
object: A deserialized object.
"""