Skip to content
This repository has been archived by the owner on Jul 19, 2018. It is now read-only.

Commit

Permalink
parse the Python Requests library user agent
Browse files Browse the repository at this point in the history
  • Loading branch information
Jason Carver committed Nov 11, 2012
1 parent 3dab0b5 commit a6d1f33
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 1 deletion.
4 changes: 4 additions & 0 deletions regexes.yaml
Expand Up @@ -327,6 +327,9 @@ user_agent_parsers:
family_replacement: 'IE'

- regex: '(Nintendo 3DS).* Version/(\d+)\.(\d+)(?:\.(\w+))'

- regex: '(python-requests)/(\d+)\.(\d+)'
family_replacement: 'Python Requests'

os_parsers:

Expand Down Expand Up @@ -516,6 +519,7 @@ os_parsers:

# just os
- regex: '(Windows|OpenBSD|FreeBSD|NetBSD|Ubuntu|Kubuntu|Android|Arch Linux|CentOS|WeTab|Slackware)'
- regex: '(Linux)/(\d+)\.(\d+)'
- regex: '(Linux|BSD)'

device_parsers:
Expand Down
6 changes: 6 additions & 0 deletions test_resources/test_user_agent_parser.yaml
Expand Up @@ -369,3 +369,9 @@ test_cases:
major: '0'
minor: '6'
patch: '1'

- user_agent_string: 'python-requests/0.14 CPython/2.6 Linux/2.6-43-server'
family: 'Python Requests'
major: '0'
minor: '14'
patch:
9 changes: 8 additions & 1 deletion test_resources/test_user_agent_parser_os.yaml
Expand Up @@ -343,4 +343,11 @@ test_cases:
major:
minor:
patch:
patch_minor:
patch_minor:

- user_agent_string: 'python-requests/0.14 CPython/2.6 Linux/2.6-43-server'
family: 'Linux'
major: '2'
minor: '6'
patch:
patch_minor:

0 comments on commit a6d1f33

Please sign in to comment.