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/
log/
*dump.json
.idea/

View File

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

View File

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

View File

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

View File

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