Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 75b7d33

Browse files
author
Sergey Polischouck
committed
fix expected behaviour to get None instead of empty string for ua version parsing
1 parent d998dbb commit 75b7d33

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

ua_parser/user_agent_parser.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -61,15 +61,15 @@ def Parse(self, user_agent_string):
6161
if self.v1_replacement:
6262
v1 = self.v1_replacement
6363
elif match.lastindex and match.lastindex >= 2:
64-
v1 = match.group(2)
64+
v1 = match.group(2) if match.group(2) != '' else None
6565

6666
if self.v2_replacement:
6767
v2 = self.v2_replacement
6868
elif match.lastindex and match.lastindex >= 3:
69-
v2 = match.group(3)
69+
v2 = match.group(3) if match.group(3) != '' else None
7070

7171
if match.lastindex and match.lastindex >= 4:
72-
v3 = match.group(4)
72+
v3 = match.group(4) if match.group(4) != '' else None
7373

7474
return family, v1, v2, v3
7575

0 commit comments

Comments
 (0)