1
0

user_agent.py 435 B

1234567891011121314
  1. from ..useragents import UserAgent
  2. from ..utils import cached_property
  3. class UserAgentMixin(object):
  4. """Adds a `user_agent` attribute to the request object which
  5. contains the parsed user agent of the browser that triggered the
  6. request as a :class:`~werkzeug.useragents.UserAgent` object.
  7. """
  8. @cached_property
  9. def user_agent(self):
  10. """The current user agent."""
  11. return UserAgent(self.environ)