Compare commits
8 Commits
Author | SHA1 | Date | |
---|---|---|---|
3426f60749 | |||
c703201ae7 | |||
0119ebe44b | |||
247d87ac5e | |||
e978c04228 | |||
e925ab455d | |||
1447b21676 | |||
575bb60f05 |
18
.github/workflows/pythonpackage.yml
vendored
18
.github/workflows/pythonpackage.yml
vendored
@ -19,7 +19,15 @@ jobs:
|
|||||||
- name: Install dependencies
|
- name: Install dependencies
|
||||||
run: |
|
run: |
|
||||||
python -m pip install --upgrade pip
|
python -m pip install --upgrade pip
|
||||||
pip install -r requirements_dev.txt
|
pip install -r requirements-dev.txt
|
||||||
|
- name: Lint with isort
|
||||||
|
run: |
|
||||||
|
pip install -U isort
|
||||||
|
isort --check erepublik
|
||||||
|
- name: Lint with Black
|
||||||
|
run: |
|
||||||
|
pip install -U black
|
||||||
|
black --check erepublik
|
||||||
- name: Lint with flake8
|
- name: Lint with flake8
|
||||||
run: |
|
run: |
|
||||||
pip install flake8
|
pip install flake8
|
||||||
@ -27,7 +35,7 @@ jobs:
|
|||||||
flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics
|
flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics
|
||||||
# exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide
|
# exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide
|
||||||
flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics
|
flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics
|
||||||
- name: Test with pytest
|
# - name: Test with pytest
|
||||||
run: |
|
# run: |
|
||||||
pip install pytest
|
# pip install pytest
|
||||||
pytest
|
# pytest
|
||||||
|
@ -1,13 +0,0 @@
|
|||||||
# See https://pre-commit.com for more information
|
|
||||||
# See https://pre-commit.com/hooks.html for more hooks
|
|
||||||
repos:
|
|
||||||
- repo: https://github.com/pre-commit/pre-commit-hooks
|
|
||||||
rev: v3.2.0
|
|
||||||
hooks:
|
|
||||||
- id: trailing-whitespace
|
|
||||||
- id: end-of-file-fixer
|
|
||||||
- id: check-yaml
|
|
||||||
- id: check-added-large-files
|
|
||||||
|
|
||||||
default_language_version:
|
|
||||||
python: python3.8
|
|
15
.readthedocs.yaml
Normal file
15
.readthedocs.yaml
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
version: 2
|
||||||
|
|
||||||
|
build:
|
||||||
|
os: "ubuntu-20.04"
|
||||||
|
tools:
|
||||||
|
python: "3.9"
|
||||||
|
|
||||||
|
# Build from the docs/ directory with Sphinx
|
||||||
|
sphinx:
|
||||||
|
configuration: docs/conf.py
|
||||||
|
|
||||||
|
# Explicitly set the version of Python and its requirements
|
||||||
|
python:
|
||||||
|
install:
|
||||||
|
- requirements: requirements-dev.txt
|
@ -10,16 +10,13 @@ eRepublik script
|
|||||||
:target: https://erepublik.readthedocs.io/en/latest/?badge=latest
|
:target: https://erepublik.readthedocs.io/en/latest/?badge=latest
|
||||||
:alt: Documentation Status
|
:alt: Documentation Status
|
||||||
|
|
||||||
.. image:: https://api.codacy.com/project/badge/Grade/eaa7ae43d23f4c0abab65c3bde89475a
|
|
||||||
:target: https://app.codacy.com/manual/eeriks/erepublik?utm_source=github.com&utm_medium=referral&utm_content=eeriks/erepublik&utm_campaign=Badge_Grade_Dashboard
|
|
||||||
:alt: Codacy Badge
|
|
||||||
|
|
||||||
|
|
||||||
Python package for automated eRepublik playing
|
Python package for automated eRepublik playing
|
||||||
|
|
||||||
|
|
||||||
* Free software: MIT license
|
* Free software: GPLv3.0
|
||||||
* Documentation: https://erepublik.readthedocs.io/en/latest/
|
* Documentation: https://erepublik.readthedocs.io/en/latest/
|
||||||
|
* Source code: https://github.com/eeriks/erepublik
|
||||||
|
|
||||||
|
|
||||||
Features
|
Features
|
||||||
|
@ -101,7 +101,7 @@ html_theme_path = [edx_theme.get_html_theme_path()]
|
|||||||
# Add any paths that contain custom static files (such as style sheets) here,
|
# Add any paths that contain custom static files (such as style sheets) here,
|
||||||
# relative to this directory. They are copied after the builtin static files,
|
# relative to this directory. They are copied after the builtin static files,
|
||||||
# so a file named "default.css" will overwrite the builtin "default.css".
|
# so a file named "default.css" will overwrite the builtin "default.css".
|
||||||
html_static_path = ["_static"]
|
# html_static_path = ["_static"]
|
||||||
|
|
||||||
|
|
||||||
# -- Options for HTMLHelp output ---------------------------------------
|
# -- Options for HTMLHelp output ---------------------------------------
|
||||||
|
@ -4,7 +4,7 @@
|
|||||||
|
|
||||||
__author__ = """Eriks Karls"""
|
__author__ = """Eriks Karls"""
|
||||||
__email__ = "eriks@72.lv"
|
__email__ = "eriks@72.lv"
|
||||||
__version__ = "0.28.0.4"
|
__version__ = "0.28.2"
|
||||||
|
|
||||||
from erepublik.citizen import Citizen
|
from erepublik.citizen import Citizen
|
||||||
|
|
||||||
|
@ -23,7 +23,7 @@ class SlowRequests(Session):
|
|||||||
if proxies:
|
if proxies:
|
||||||
self.proxies = proxies
|
self.proxies = proxies
|
||||||
if user_agent is None:
|
if user_agent is None:
|
||||||
user_agent = random.choice(self.get_random_user_agent())
|
user_agent = self.get_random_user_agent()
|
||||||
self.request_log_name = utils.get_file(utils.now().strftime("debug/requests_%Y-%m-%d.log"))
|
self.request_log_name = utils.get_file(utils.now().strftime("debug/requests_%Y-%m-%d.log"))
|
||||||
self.last_time = utils.now()
|
self.last_time = utils.now()
|
||||||
self.headers.update({"User-Agent": user_agent})
|
self.headers.update({"User-Agent": user_agent})
|
||||||
@ -110,24 +110,15 @@ 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 = [f"Android {version}; Mobile" for version in range(8, 12)]
|
android = [] # [f"Android {version}; Mobile" for version in range(10, 13)]
|
||||||
|
|
||||||
firefox_template = "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"
|
||||||
firefox_versions = range(85, 92)
|
firefox_versions = range(92, 97)
|
||||||
|
|
||||||
chrome_template = (
|
chrome_template = (
|
||||||
"Mozilla/5.0 ({osystem}) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/{version} Safari/537.36"
|
"Mozilla/5.0 ({osystem}) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/{version} Safari/537.36"
|
||||||
)
|
)
|
||||||
chrome_versions = [
|
chrome_versions = ["92.0.4515.159", "93.0.4577.82", "94.0.4606.81", "95.0.4638.54", "96.0.4664.110"]
|
||||||
"85.0.4183.121",
|
|
||||||
"86.0.4240.183",
|
|
||||||
"87.0.4280.141",
|
|
||||||
"88.0.4324.182",
|
|
||||||
"89.0.4389.128",
|
|
||||||
"90.0.4430.18",
|
|
||||||
"91.0.4472.73",
|
|
||||||
"92.0.4515.159",
|
|
||||||
]
|
|
||||||
uas = []
|
uas = []
|
||||||
|
|
||||||
for osystem in [windows_x64, linux_x64, *android]:
|
for osystem in [windows_x64, linux_x64, *android]:
|
||||||
|
@ -724,20 +724,14 @@ class Reporter:
|
|||||||
self._citizen = weakref.ref(citizen)
|
self._citizen = weakref.ref(citizen)
|
||||||
self._req = Session()
|
self._req = Session()
|
||||||
self.url = "https://erep.lv"
|
self.url = "https://erep.lv"
|
||||||
self._req.headers.update(
|
self._req.headers.update({"user-agent": "eRepublik Script Reporter v3", "erep-version": utils.__version__})
|
||||||
{
|
|
||||||
"user-agent": "eRepublik Script Reporter v3",
|
|
||||||
"erep-version": utils.__version__,
|
|
||||||
"erep-user-id": str(self.citizen_id),
|
|
||||||
"erep-user-name": self.citizen.name,
|
|
||||||
}
|
|
||||||
)
|
|
||||||
self.__to_update = []
|
self.__to_update = []
|
||||||
self.__registered: bool = False
|
self.__registered: bool = False
|
||||||
|
|
||||||
def do_init(self):
|
def do_init(self):
|
||||||
self.key: str = ""
|
self.key: str = ""
|
||||||
self.__update_key()
|
self.__update_key()
|
||||||
|
self._req.headers.update({"erep-user-id": str(self.citizen_id), "erep-user-name": self.name})
|
||||||
self.register_account()
|
self.register_account()
|
||||||
self.allowed = True
|
self.allowed = True
|
||||||
|
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
PySocks==1.7.1
|
PySocks==1.7.1
|
||||||
pytz==2021.3
|
pytz==2021.3
|
||||||
requests==2.26.0
|
requests==2.27.0
|
||||||
requests-toolbelt==0.9.1
|
requests-toolbelt==0.9.1
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
[bumpversion]
|
[bumpversion]
|
||||||
current_version = 0.28.0.4
|
current_version = 0.28.2
|
||||||
commit = True
|
commit = True
|
||||||
tag = True
|
tag = True
|
||||||
parse = (?P<major>\d+)\.(?P<minor>\d+)\.(?P<patch>\d+)\.?(?P<dev>\d+)?
|
parse = (?P<major>\d+)\.(?P<minor>\d+)\.(?P<patch>\d+)\.?(?P<dev>\d+)?
|
||||||
|
2
setup.py
2
setup.py
@ -49,6 +49,6 @@ setup(
|
|||||||
test_suite="tests",
|
test_suite="tests",
|
||||||
tests_require=test_requirements,
|
tests_require=test_requirements,
|
||||||
url="https://github.com/eeriks/erepublik/",
|
url="https://github.com/eeriks/erepublik/",
|
||||||
version="0.28.0.4",
|
version="0.28.2",
|
||||||
zip_safe=False,
|
zip_safe=False,
|
||||||
)
|
)
|
||||||
|
Reference in New Issue
Block a user