Skip to content

Latest commit

 

History

History
60 lines (43 loc) · 1.14 KB

README.md

File metadata and controls

60 lines (43 loc) · 1.14 KB

python-useragentutils

A python port of the user-agent-utils Java library

Installation

pip install useragentutils

Usage

from useragentutils import UserAgent

uaString = "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_8_2) AppleWebKit/536.26.14 (KHTML, like Gecko) Version/6.0.1 Safari/536.26.14"

ua = UserAgent(uaString)

browser = ua.browser
print(browser)
print(browser.version(uaString))
print(browser.manufacturer)
print(browser.renderingEngine)
print(browser.browserType)

os = ua.operatingSystem
print(os)
print(os.version(uaString))
print(os.manufacturer)
print(os.deviceType)

Developing

Setup vagrant in the usual way (see: vagrant-setup).

Setup your environment:

cd $PROJECT_DIR
mkvirtualenv python-useragentutils
setvirtualenvproject .
pip install --upgrade pip==1.4.1
pip install -r requirements.pip

Run the tests:

nosetests

Write some code including tests..

Run the tests:

nosetests

File PRs against master w/ a new semantic version. When it merges jenkins will put the package in our pip repo.