Compare commits
6 Commits
Author | SHA1 | Date | |
---|---|---|---|
7054ae2b05 | |||
2288fe01ea | |||
dfa6f7e0be | |||
1746f27193 | |||
c8f9ac9768 | |||
7773b63520 |
5
Makefile
5
Makefile
@ -52,8 +52,9 @@ clean-test: ## remove test and coverage artifacts
|
|||||||
rm -fr .pytest_cache
|
rm -fr .pytest_cache
|
||||||
|
|
||||||
lint: ## check style with flake8
|
lint: ## check style with flake8
|
||||||
black erepublik tests
|
isort erepublik examples tests
|
||||||
flake8 erepublik tests
|
black erepublik examples tests
|
||||||
|
flake8 erepublik examples tests
|
||||||
|
|
||||||
test: ## run tests quickly with the default Python
|
test: ## run tests quickly with the default Python
|
||||||
python -m unittest
|
python -m unittest
|
||||||
|
@ -4,7 +4,7 @@
|
|||||||
|
|
||||||
__author__ = """Eriks Karls"""
|
__author__ = """Eriks Karls"""
|
||||||
__email__ = "eriks@72.lv"
|
__email__ = "eriks@72.lv"
|
||||||
__version__ = "0.26.0.1"
|
__version__ = "0.27.0"
|
||||||
|
|
||||||
from erepublik.citizen import Citizen
|
from erepublik.citizen import Citizen
|
||||||
|
|
||||||
|
@ -180,12 +180,21 @@ class BaseCitizen(access_points.CitizenAPI):
|
|||||||
ugly_js_match = re.search(r'"promotions":\s*(\[{?.*?}?])', html)
|
ugly_js_match = re.search(r'"promotions":\s*(\[{?.*?}?])', html)
|
||||||
ugly_js = ugly_js_match.group(1) if ugly_js_match else "null"
|
ugly_js = ugly_js_match.group(1) if ugly_js_match else "null"
|
||||||
promos = utils.json_loads(utils.normalize_html_json(ugly_js))
|
promos = utils.json_loads(utils.normalize_html_json(ugly_js))
|
||||||
self.promos = {}
|
if self.promos:
|
||||||
if promos:
|
self.promos = {k: v for k, v in self.promos.items() if v > self.now}
|
||||||
self.promos = {k: v for k, v in promos.items() if v > self.now}
|
else:
|
||||||
for kind, time_until in self.promos.items():
|
self.promos = {}
|
||||||
self.reporter.report_promo(kind, time_until)
|
|
||||||
|
|
||||||
|
try:
|
||||||
|
if promos:
|
||||||
|
for promo in promos:
|
||||||
|
kind = promo["typeId"]
|
||||||
|
time_until = utils.localize_timestamp(promo["expiresAt"])
|
||||||
|
if kind not in self.promos:
|
||||||
|
self.reporter.report_promo(kind, time_until)
|
||||||
|
self.promos[kind] = time_until
|
||||||
|
except Exception:
|
||||||
|
self.process_error()
|
||||||
new_date = re.search(r"var new_date = '(\d*)';", html)
|
new_date = re.search(r"var new_date = '(\d*)';", html)
|
||||||
if new_date:
|
if new_date:
|
||||||
self.energy.set_reference_time(utils.good_timedelta(self.now, timedelta(seconds=int(new_date.group(1)))))
|
self.energy.set_reference_time(utils.good_timedelta(self.now, timedelta(seconds=int(new_date.group(1)))))
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
[bumpversion]
|
[bumpversion]
|
||||||
current_version = 0.26.0.1
|
current_version = 0.27.0
|
||||||
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+)?
|
||||||
|
6
setup.py
6
setup.py
@ -30,7 +30,7 @@ setup(
|
|||||||
classifiers=[
|
classifiers=[
|
||||||
"Development Status :: 4 - Beta",
|
"Development Status :: 4 - Beta",
|
||||||
"Intended Audience :: Developers",
|
"Intended Audience :: Developers",
|
||||||
"License :: OSI Approved :: GPLv3 License",
|
"License :: OSI Approved :: GNU General Public License v3 (GPLv3)",
|
||||||
"Natural Language :: English",
|
"Natural Language :: English",
|
||||||
"Programming Language :: Python :: 3",
|
"Programming Language :: Python :: 3",
|
||||||
"Programming Language :: Python :: 3.8",
|
"Programming Language :: Python :: 3.8",
|
||||||
@ -39,7 +39,7 @@ setup(
|
|||||||
description="Python package for automated eRepublik playing",
|
description="Python package for automated eRepublik playing",
|
||||||
entry_points={},
|
entry_points={},
|
||||||
install_requires=requirements,
|
install_requires=requirements,
|
||||||
license="GPLv3 license",
|
license="GPLv3",
|
||||||
long_description=readme + "\n\n" + history,
|
long_description=readme + "\n\n" + history,
|
||||||
include_package_data=True,
|
include_package_data=True,
|
||||||
keywords="erepublik",
|
keywords="erepublik",
|
||||||
@ -50,6 +50,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.26.0.1",
|
version="0.27.0",
|
||||||
zip_safe=False,
|
zip_safe=False,
|
||||||
)
|
)
|
||||||
|
@ -3,10 +3,10 @@
|
|||||||
|
|
||||||
"""Tests for `erepublik` package."""
|
"""Tests for `erepublik` package."""
|
||||||
|
|
||||||
from erepublik import Citizen
|
|
||||||
|
|
||||||
import unittest
|
import unittest
|
||||||
|
|
||||||
|
from erepublik import Citizen
|
||||||
|
|
||||||
|
|
||||||
class TestErepublik(unittest.TestCase):
|
class TestErepublik(unittest.TestCase):
|
||||||
"""Tests for `erepublik` package."""
|
"""Tests for `erepublik` package."""
|
||||||
|
Reference in New Issue
Block a user