Compare commits
15 Commits
Author | SHA1 | Date | |
---|---|---|---|
7e5312df18 | |||
8474920b72 | |||
3426f60749 | |||
c703201ae7 | |||
0119ebe44b | |||
247d87ac5e | |||
e978c04228 | |||
e925ab455d | |||
1447b21676 | |||
575bb60f05 | |||
81c1469752 | |||
490809045d | |||
f425faea5b | |||
8b264e2b9c | |||
711a61783c |
18
.github/workflows/pythonpackage.yml
vendored
18
.github/workflows/pythonpackage.yml
vendored
@ -19,7 +19,15 @@ jobs:
|
||||
- name: Install dependencies
|
||||
run: |
|
||||
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
|
||||
run: |
|
||||
pip install flake8
|
||||
@ -27,7 +35,7 @@ jobs:
|
||||
flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics
|
||||
# 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
|
||||
- name: Test with pytest
|
||||
run: |
|
||||
pip install pytest
|
||||
pytest
|
||||
# - name: Test with pytest
|
||||
# run: |
|
||||
# pip install 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
|
||||
: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
|
||||
|
||||
|
||||
* Free software: MIT license
|
||||
* Free software: GPLv3.0
|
||||
* Documentation: https://erepublik.readthedocs.io/en/latest/
|
||||
* Source code: https://github.com/eeriks/erepublik
|
||||
|
||||
|
||||
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,
|
||||
# relative to this directory. They are copied after the builtin static files,
|
||||
# so a file named "default.css" will overwrite the builtin "default.css".
|
||||
html_static_path = ["_static"]
|
||||
# html_static_path = ["_static"]
|
||||
|
||||
|
||||
# -- Options for HTMLHelp output ---------------------------------------
|
||||
|
@ -4,7 +4,7 @@
|
||||
|
||||
__author__ = """Eriks Karls"""
|
||||
__email__ = "eriks@72.lv"
|
||||
__version__ = "0.28.0.2"
|
||||
__version__ = "0.28.3"
|
||||
|
||||
from erepublik.citizen import Citizen
|
||||
|
||||
|
@ -23,7 +23,7 @@ class SlowRequests(Session):
|
||||
if proxies:
|
||||
self.proxies = proxies
|
||||
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.last_time = utils.now()
|
||||
self.headers.update({"User-Agent": user_agent})
|
||||
@ -110,24 +110,15 @@ class SlowRequests(Session):
|
||||
def get_random_user_agent() -> str:
|
||||
windows_x64 = "Windows NT 10.0; Win64; x64"
|
||||
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_versions = range(85, 92)
|
||||
firefox_versions = range(92, 97)
|
||||
|
||||
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",
|
||||
"88.0.4324.182",
|
||||
"89.0.4389.128",
|
||||
"90.0.4430.18",
|
||||
"91.0.4472.73",
|
||||
"92.0.4515.159",
|
||||
]
|
||||
chrome_versions = ["92.0.4515.159", "93.0.4577.82", "94.0.4606.81", "95.0.4638.54", "96.0.4664.110"]
|
||||
uas = []
|
||||
|
||||
for osystem in [windows_x64, linux_x64, *android]:
|
||||
|
@ -416,6 +416,13 @@ class Config:
|
||||
auto_sell: List[str] = None
|
||||
auto_sell_all = False
|
||||
employees = False
|
||||
interactive = True
|
||||
auto_buy_raw = False
|
||||
force_wam = False
|
||||
telegram = True
|
||||
telegram_chat_id = 0
|
||||
telegram_token = ""
|
||||
spin_wheel_of_fortune = False
|
||||
# fight = False
|
||||
# air = False
|
||||
# ground = False
|
||||
@ -427,17 +434,10 @@ class Config:
|
||||
# epic_hunt = False
|
||||
# epic_hunt_ebs = False
|
||||
# rw_def_side = False
|
||||
# interactive = True
|
||||
# continuous_fighting = False
|
||||
auto_buy_raw = False
|
||||
force_wam = False
|
||||
# sort_battles_time = True
|
||||
# force_travel = False
|
||||
telegram = True
|
||||
telegram_chat_id = 0
|
||||
telegram_token = ""
|
||||
# maverick = False
|
||||
spin_wheel_of_fortune = False
|
||||
|
||||
def __init__(self):
|
||||
self.auto_sell = []
|
||||
@ -450,6 +450,13 @@ class Config:
|
||||
self.auto_sell = list()
|
||||
self.auto_sell_all = False
|
||||
self.employees = False
|
||||
self.interactive = True
|
||||
self.auto_buy_raw = False
|
||||
self.force_wam = False
|
||||
self.telegram = True
|
||||
self.telegram_chat_id = 0
|
||||
self.telegram_token = ""
|
||||
self.spin_wheel_of_fortune = False
|
||||
# self.fight = False
|
||||
# self.air = False
|
||||
# self.ground = False
|
||||
@ -461,17 +468,10 @@ class Config:
|
||||
# self.epic_hunt = False
|
||||
# self.epic_hunt_ebs = False
|
||||
# self.rw_def_side = False
|
||||
# self.interactive = True
|
||||
# self.continuous_fighting = False
|
||||
self.auto_buy_raw = False
|
||||
self.force_wam = False
|
||||
# self.sort_battles_time = True
|
||||
# self.force_travel = False
|
||||
self.telegram = True
|
||||
self.telegram_chat_id = 0
|
||||
self.telegram_token = ""
|
||||
# self.maverick = False
|
||||
self.spin_wheel_of_fortune = False
|
||||
|
||||
@property
|
||||
def as_dict(self) -> Dict[str, Union[bool, int, str, List[str]]]:
|
||||
@ -484,6 +484,13 @@ class Config:
|
||||
auto_sell=self.auto_sell,
|
||||
auto_sell_all=self.auto_sell_all,
|
||||
employees=self.employees,
|
||||
interactive=self.interactive,
|
||||
auto_buy_raw=self.auto_buy_raw,
|
||||
force_wam=self.force_wam,
|
||||
telegram=self.telegram,
|
||||
telegram_chat_id=self.telegram_chat_id,
|
||||
telegram_token=self.telegram_token,
|
||||
spin_wheel_of_fortune=self.spin_wheel_of_fortune,
|
||||
# fight=self.fight,
|
||||
# air=self.air,
|
||||
# ground=self.ground,
|
||||
@ -494,17 +501,10 @@ class Config:
|
||||
# epic_hunt=self.epic_hunt,
|
||||
# epic_hunt_ebs=self.epic_hunt_ebs,
|
||||
# rw_def_side=self.rw_def_side,
|
||||
# interactive=self.interactive,
|
||||
# maverick=self.maverick,
|
||||
# continuous_fighting=self.continuous_fighting,
|
||||
auto_buy_raw=self.auto_buy_raw,
|
||||
force_wam=self.force_wam,
|
||||
# sort_battles_time=self.sort_battles_time,
|
||||
# force_travel=self.force_travel,
|
||||
telegram=self.telegram,
|
||||
telegram_chat_id=self.telegram_chat_id,
|
||||
telegram_token=self.telegram_token,
|
||||
spin_wheel_of_fortune=self.spin_wheel_of_fortune,
|
||||
)
|
||||
|
||||
|
||||
@ -724,20 +724,14 @@ class Reporter:
|
||||
self._citizen = weakref.ref(citizen)
|
||||
self._req = Session()
|
||||
self.url = "https://erep.lv"
|
||||
self._req.headers.update(
|
||||
{
|
||||
"user-agent": "eRepublik Script Reporter v3",
|
||||
"erep-version": utils.__version__,
|
||||
"erep-user-id": str(self.citizen_id),
|
||||
"erep-user-name": self.citizen.name,
|
||||
}
|
||||
)
|
||||
self._req.headers.update({"user-agent": "eRepublik Script Reporter v3", "erep-version": utils.__version__})
|
||||
self.__to_update = []
|
||||
self.__registered: bool = False
|
||||
|
||||
def do_init(self):
|
||||
self.key: str = ""
|
||||
self.__update_key()
|
||||
self._req.headers.update({"erep-user-id": str(self.citizen_id), "erep-user-name": self.name})
|
||||
self.register_account()
|
||||
self.allowed = True
|
||||
|
||||
|
@ -1,16 +1,16 @@
|
||||
-r requirements.txt
|
||||
-r requirements-tests.txt
|
||||
bump2version==1.0.1
|
||||
coverage==6.1.1
|
||||
coverage==6.3
|
||||
edx-sphinx-theme==3.0.0
|
||||
flake8==4.0.1
|
||||
ipython>=7.29.0
|
||||
ipython>=8.0.1
|
||||
jedi!=0.18.0
|
||||
isort==5.9.3
|
||||
pre-commit==2.15.0
|
||||
pur==5.4.2
|
||||
responses==0.15.0
|
||||
Sphinx==4.2.0
|
||||
twine==3.4.2
|
||||
wheel==0.37.0
|
||||
black==21.7b0
|
||||
isort==5.10.1
|
||||
pre-commit==2.17.0
|
||||
pur==6.0.1
|
||||
responses==0.17.0
|
||||
Sphinx==4.4.0
|
||||
twine==3.7.1
|
||||
wheel==0.37.1
|
||||
black==21.12b0
|
||||
|
@ -1,4 +1,4 @@
|
||||
PySocks==1.7.1
|
||||
pytz==2021.3
|
||||
requests==2.26.0
|
||||
pytz>2021.0
|
||||
requests>2.25.0,!=2.27.0
|
||||
requests-toolbelt==0.9.1
|
||||
|
@ -1,5 +1,5 @@
|
||||
[bumpversion]
|
||||
current_version = 0.28.0.2
|
||||
current_version = 0.28.3
|
||||
commit = True
|
||||
tag = True
|
||||
parse = (?P<major>\d+)\.(?P<minor>\d+)\.(?P<patch>\d+)\.?(?P<dev>\d+)?
|
||||
|
Reference in New Issue
Block a user