request.py 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. from .accept import AcceptMixin
  2. from .auth import AuthorizationMixin
  3. from .base_request import BaseRequest
  4. from .common_descriptors import CommonRequestDescriptorsMixin
  5. from .etag import ETagRequestMixin
  6. from .user_agent import UserAgentMixin
  7. class Request(
  8. BaseRequest,
  9. AcceptMixin,
  10. ETagRequestMixin,
  11. UserAgentMixin,
  12. AuthorizationMixin,
  13. CommonRequestDescriptorsMixin,
  14. ):
  15. """Full featured request object implementing the following mixins:
  16. - :class:`AcceptMixin` for accept header parsing
  17. - :class:`ETagRequestMixin` for etag and cache control handling
  18. - :class:`UserAgentMixin` for user agent introspection
  19. - :class:`AuthorizationMixin` for http auth handling
  20. - :class:`CommonRequestDescriptorsMixin` for common headers
  21. """
  22. class StreamOnlyMixin(object):
  23. """If mixed in before the request object this will change the bahavior
  24. of it to disable handling of form parsing. This disables the
  25. :attr:`files`, :attr:`form` attributes and will just provide a
  26. :attr:`stream` attribute that however is always available.
  27. .. versionadded:: 0.9
  28. """
  29. disable_data_descriptor = True
  30. want_form_data_parsed = False
  31. class PlainRequest(StreamOnlyMixin, Request):
  32. """A request object without special form parsing capabilities.
  33. .. versionadded:: 0.9
  34. """