werkzeug.UserAgent

class werkzeug.UserAgent(environ_or_string)[source]

Represents a user agent. Pass it a WSGI environment or a user agent string and you can inspect some of the details from the user agent string via the attributes. The following attributes exist:

string

the raw user agent string

platform

the browser platform. The following platforms are currently recognized:

  • aix
  • amiga
  • android
  • bsd
  • chromeos
  • hpux
  • iphone
  • ipad
  • irix
  • linux
  • macos
  • sco
  • solaris
  • wii
  • windows
browser

the name of the browser. The following browsers are currently recognized:

  • aol *
  • ask *
  • camino
  • chrome
  • firefox
  • galeon
  • google *
  • kmeleon
  • konqueror
  • links
  • lynx
  • msie
  • msn
  • netscape
  • opera
  • safari
  • seamonkey
  • webkit
  • yahoo *

(Browsers maked with a star (*) are crawlers.)

version

the version of the browser

language

the language of the browser

Methods

__init__(environ_or_string)
to_header()