Browser UA version update

gitignore

Updated constants

Requirements update
This commit is contained in:
Eriks K
2021-08-18 09:11:23 +03:00
parent 61df989cb4
commit 86e738ad08
5 changed files with 39 additions and 33 deletions

1
.gitignore vendored
View File

@ -103,3 +103,4 @@ ENV/
debug/ debug/
log/ log/
*dump.json *dump.json
.idea/

View File

@ -110,15 +110,13 @@ class SlowRequests(Session):
def get_random_user_agent() -> str: def get_random_user_agent() -> str:
windows_x64 = "Windows NT 10.0; Win64; x64" windows_x64 = "Windows NT 10.0; Win64; x64"
linux_x64 = "X11; Linux x86_64" linux_x64 = "X11; Linux x86_64"
android_11 = "Android 11; Mobile" android = [f"Android {version}; Mobile" for version in range(8, 12)]
android_10 = "Android 10; Mobile"
android_9 = "Android 9; Mobile"
firefox_tmplt = "Mozilla/5.0 ({osystem}; rv:{version}.0) Gecko/20100101 Firefox/{version}.0" firefox_template = "Mozilla/5.0 ({osystem}; rv:{version}.0) Gecko/20100101 Firefox/{version}.0"
ff_version = range(85, 92) firefox_versions = range(85, 92)
chrome_tmplt = "Mozilla/5.0 ({osystem}) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/{version} Safari/537.36" chrome_template = "Mozilla/5.0 ({osystem}) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/{version} Safari/537.36"
chrome_version = [ chrome_versions = [
"85.0.4183.121", "85.0.4183.121",
"86.0.4240.183", "86.0.4240.183",
"87.0.4280.141", "87.0.4280.141",
@ -126,15 +124,15 @@ class SlowRequests(Session):
"89.0.4389.128", "89.0.4389.128",
"90.0.4430.18", "90.0.4430.18",
"91.0.4472.73", "91.0.4472.73",
"92.0.4515.14", "92.0.4515.159",
] ]
uas = [] uas = []
for osystem in [windows_x64, linux_x64, android_9, android_10, android_11]: for osystem in [windows_x64, linux_x64, *android]:
for version in ff_version: for version in firefox_versions:
uas.append(firefox_tmplt.format(osystem=osystem, version=version)) uas.append(firefox_template.format(osystem=osystem, version=version))
for version in chrome_version: for version in chrome_versions:
uas.append(chrome_tmplt.format(osystem=osystem, version=version)) uas.append(chrome_template.format(osystem=osystem, version=version))
return random.choice(uas) return random.choice(uas)

View File

@ -8,7 +8,9 @@ __all__ = [
"min_datetime", "min_datetime",
"max_datetime", "max_datetime",
"Country", "Country",
"Rank",
"AIR_RANKS", "AIR_RANKS",
"AIR_RANK_POINTS",
"COUNTRIES", "COUNTRIES",
"FOOD_ENERGY", "FOOD_ENERGY",
"GROUND_RANKS", "GROUND_RANKS",
@ -199,6 +201,10 @@ class Rank:
def as_dict(self): def as_dict(self):
return dict(id=self.id, name=self.name, rank_points=self.rank_points, is_air=self.is_air) return dict(id=self.id, name=self.name, rank_points=self.rank_points, is_air=self.is_air)
@property
def __dict__(self):
return self.as_dict
def __str__(self): def __str__(self):
return f"{'Air' if self.is_air else 'Ground'}Rank<#{self.id} {self.name}>" return f"{'Air' if self.is_air else 'Ground'}Rank<#{self.id} {self.name}>"

View File

@ -23,33 +23,33 @@ except ImportError:
import json import json
__all__ = [ __all__ = [
"ErepublikJSONEncoder",
"VERSION", "VERSION",
"b64json",
"calculate_hit", "calculate_hit",
"date_from_eday", "date_from_eday",
"eday_from_date",
"deprecation", "deprecation",
"get_final_hit_dmg", "eday_from_date",
"write_file",
"get_air_hit_dmg_value", "get_air_hit_dmg_value",
"get_file", "get_file",
"get_final_hit_dmg",
"get_ground_hit_dmg_value", "get_ground_hit_dmg_value",
"get_sleep_seconds", "get_sleep_seconds",
"good_timedelta", "good_timedelta",
"slugify",
"interactive_sleep", "interactive_sleep",
"json", "json",
"json_decode_object_hook",
"json_dump",
"json_dumps",
"json_load",
"json_loads",
"localize_dt", "localize_dt",
"localize_timestamp", "localize_timestamp",
"normalize_html_json", "normalize_html_json",
"now", "now",
"silent_sleep", "silent_sleep",
"json_decode_object_hook", "slugify",
"json_load", "write_file",
"json_loads",
"json_dump",
"json_dumps",
"b64json",
"ErepublikJSONEncoder",
] ]
VERSION: str = __version__ VERSION: str = __version__

View File

@ -2,20 +2,21 @@ bump2version==1.0.1
coverage==5.5 coverage==5.5
edx-sphinx-theme==3.0.0 edx-sphinx-theme==3.0.0
flake8==3.9.2 flake8==3.9.2
ipython>=7.25.0 ipython>=7.26.0
jedi!=0.18.0 jedi!=0.18.0
isort==5.9.2 isort==5.9.3
pip==21.1.3 pip==21.2.4
pre-commit==2.13.0 pre-commit==2.14.0
pur==5.4.2 pur==5.4.2
PyInstaller==4.4 PyInstaller==4.5.1
PySocks==1.7.1 PySocks==1.7.1
pytest==6.2.4 pytest==6.2.4
pytz==2021.1 pytz==2021.1
requests==2.26.0 requests==2.26.0
requests-toolbelt==0.9.1 requests-toolbelt==0.9.1
responses==0.13.3 responses==0.13.4
setuptools==57.4.0 setuptools==57.4.0
Sphinx==4.1.1 Sphinx==4.1.2
twine==3.4.1 twine==3.4.2
wheel==0.36.2 wheel==0.37.0
black==21.7b0