Compare commits

..

10 Commits

Author SHA1 Message Date
7e5312df18 Bump version: 0.28.2 → 0.28.3 2022-01-26 14:03:21 +02:00
8474920b72 Bugfix requests 2.27.0 contains bug which prohibits using auth with socks proxy 2022-01-26 14:03:11 +02:00
3426f60749 Bump version: 0.28.1 → 0.28.2 2022-01-26 13:10:23 +02:00
c703201ae7 Bugfix 2022-01-26 13:10:07 +02:00
0119ebe44b Bump version: 0.28.0.4 → 0.28.1 2022-01-06 10:11:50 +02:00
247d87ac5e Update UA browser versions; Remove Android as system platform
lint
2022-01-06 10:11:35 +02:00
e978c04228 Initialize headers after login 2021-11-26 09:53:00 +02:00
e925ab455d RTD yaml 2021-11-24 17:02:19 +02:00
1447b21676 Small fixes 2021-11-24 16:54:36 +02:00
575bb60f05 GitHub worklflow update 2021-11-24 14:36:15 +02:00
12 changed files with 52 additions and 60 deletions

View File

@ -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

View File

@ -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
View 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

View File

@ -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

View File

@ -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 ---------------------------------------

View File

@ -4,7 +4,7 @@
__author__ = """Eriks Karls"""
__email__ = "eriks@72.lv"
__version__ = "0.28.0.4"
__version__ = "0.28.3"
from erepublik.citizen import Citizen

View File

@ -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]:

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -1,5 +1,5 @@
[bumpversion]
current_version = 0.28.0.4
current_version = 0.28.3
commit = True
tag = True
parse = (?P<major>\d+)\.(?P<minor>\d+)\.(?P<patch>\d+)\.?(?P<dev>\d+)?

View File

@ -49,6 +49,6 @@ setup(
test_suite="tests",
tests_require=test_requirements,
url="https://github.com/eeriks/erepublik/",
version="0.28.0.4",
version="0.28.3",
zip_safe=False,
)