browserinfo package¶
Module contents¶
Lightweight API wrapper for browser-info.net.
-
exception
browserinfo.
BrowserinfoError
(message)¶ Bases:
exceptions.Exception
Base class for exceptions thrown by this library.
Parameters: message (str) – The error message
-
exception
browserinfo.
DOMChanged
¶ Bases:
browserinfo.BrowserinfoError
Raised when the DOM is not parsable.
Over time, the page might change and no longer be parsable with the current rule set. In case this happens, this exception is raised with a link to the repository to file an issue.
-
browserinfo.
popular
(amount=20)¶ Fetches populsr UA strings.
Retrieves most popular UA strings, up to a maximum of 20.
Parameters: amount (int) – The amount of UA strings to retrieve Returns: List of UA strings Return type: list Raises: DOMChanged – When retrieved amount does not match requested amount Example: >>> import browserinfo >>> browserinfo.popular(1) ['Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; FSL 7.0.6.01001)']
-
browserinfo.
recent
(amount=20)¶ Fetches recent UA strings.
Retrieves most recent UA strings, up to a maximum of 20.
Parameters: amount (int) – The amount of UA strings to retrieve Returns: List of UA strings Return type: list Raises: DOMChanged – When retrieved amount does not match requested amount Example: >>> import browserinfo >>> browserinfo.recent(1) ['Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/40.0.2214.85 Safari/537.36']