User-Agent parsing and creation
Project description
ua
User-Agent parsing and creation
Installation
pip install ua
Usage
>>> import ua
Parsing
>>> user_agent = ua.parse('Mozilla/5.0 (X11; Linux x86_64; rv:88.0) Gecko/20100101 Firefox/88.0')
>>>
>>> user_agent
UserAgent(
products=[
Product(name='Mozilla', version='5.0', comments=['X11', 'Linux x86_64', 'rv:88.0']),
Product(name='Gecko', version='20100101', comments=[]),
Product(name='Firefox', version='88.0', comments=[])
]
)
>>>
>>> str(user_agent)
'Mozilla/5.0 (X11; Linux x86_64; rv:88.0) Gecko/20100101 Firefox/88.0'
Creation
>>> user_agent = ua.UserAgent(
products=[
ua.Product(
name='SomeProduct',
version='1.0',
comments=['SomeComment']
)
]
)
>>>
>>> str(user_agent)
'SomeProduct/1.0 (SomeComment)'
References
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
ua-0.1.5.tar.gz
(3.4 kB
view hashes)
Built Distribution
ua-0.1.5-py3-none-any.whl
(3.8 kB
view hashes)