File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ #!/usr/bin/env python3
2+ # -*- coding: utf-8 -*-
3+
4+ __author__ = 'ipetrash'
5+
6+
7+ import random
8+
9+
10+ class UserAgent :
11+ @classmethod
12+ def get_win_version (cls ) -> float :
13+ return 10.0
14+
15+ @classmethod
16+ def get_chrome_version (cls ) -> str :
17+ a = random .randint (40 , 69 )
18+ b = random .randint (2987 , 3497 )
19+ c = random .randint (80 , 140 )
20+ return '{}.0.{}.{}' .format (a , b , c )
21+
22+ @classmethod
23+ def get (cls ) -> str :
24+ a = 'Mozilla/5.0 (Windows NT {}; Win64; x64)' .format (cls .get_win_version ())
25+ b = 'AppleWebKit/537.36 (KHTML, like Gecko) Chrome/{} Safari/537.36' .format (cls .get_chrome_version ())
26+ return '{} {}' .format (a , b )
27+
28+
29+ if __name__ == '__main__' :
30+ print (UserAgent .get ())
31+ # Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36
32+ # (KHTML, like Gecko) Chrome/41.0.2993.140 Safari/537.36
You can’t perform that action at this time.
0 commit comments