Compare commits
2 Commits
Author | SHA1 | Date | |
---|---|---|---|
6b7639d7fb | |||
3b1c1928fd |
@ -4,7 +4,7 @@
|
||||
|
||||
__author__ = """Eriks Karls"""
|
||||
__email__ = 'eriks@72.lv'
|
||||
__version__ = '0.21.4.8'
|
||||
__version__ = '0.21.5'
|
||||
|
||||
from erepublik import classes, utils, constants
|
||||
from erepublik.citizen import Citizen
|
||||
|
@ -38,8 +38,10 @@ class SlowRequests(Session):
|
||||
]
|
||||
debug: bool = False
|
||||
|
||||
def __init__(self):
|
||||
def __init__(self, proxies: Dict[str, str] = None):
|
||||
super().__init__()
|
||||
if proxies:
|
||||
self.proxies = proxies
|
||||
self.request_log_name = utils.get_file(utils.now().strftime("debug/requests_%Y-%m-%d.log"))
|
||||
self.last_time = utils.now()
|
||||
self.headers.update({
|
||||
@ -132,6 +134,14 @@ class CitizenBaseAPI:
|
||||
def _get_main(self) -> Response:
|
||||
return self.get(self.url)
|
||||
|
||||
def set_socks_proxy(self, host: str, port: int, username: str = None, password: str = None):
|
||||
url = f'socks5://{username}:{password}@{host}:{port}' if username and password else f'socks5://{host}:{port}'
|
||||
self._req.proxies = dict(http=url, https=url)
|
||||
|
||||
def set_http_proxy(self, host: str, port: int, username: str = None, password: str = None):
|
||||
url = f'http://{username}:{password}@{host}:{port}' if username and password else f'socks5://{host}:{port}'
|
||||
self._req.proxies = dict(http=url)
|
||||
|
||||
|
||||
class ErepublikAnniversaryAPI(CitizenBaseAPI):
|
||||
def _post_main_collect_anniversary_reward(self) -> Response:
|
||||
|
@ -7,11 +7,11 @@ isort==5.5.3
|
||||
pip==20.2.3
|
||||
PyInstaller==4.0
|
||||
pytz==2020.1
|
||||
pytest==6.0.2
|
||||
pytest==6.1.0
|
||||
responses==0.12.0
|
||||
setuptools==50.3.0
|
||||
Sphinx==3.2.1
|
||||
requests==2.24.0
|
||||
requests[socks]==2.24.0
|
||||
tox==3.20.0
|
||||
twine==3.2.0
|
||||
watchdog==0.10.3
|
||||
|
@ -1,5 +1,5 @@
|
||||
[bumpversion]
|
||||
current_version = 0.21.4.8
|
||||
current_version = 0.21.5
|
||||
commit = True
|
||||
tag = True
|
||||
parse = (?P<major>\d+)\.(?P<minor>\d+)\.(?P<patch>\d+)\.?(?P<dev>\d+)?
|
||||
|
4
setup.py
4
setup.py
@ -11,7 +11,7 @@ with open('README.rst') as readme_file:
|
||||
with open('HISTORY.rst') as history_file:
|
||||
history = history_file.read()
|
||||
|
||||
requirements = ['pytz==2020.1', 'requests==2.24.0']
|
||||
requirements = ['pytz==2020.1', 'requests[socks]==2.24.0']
|
||||
|
||||
setup_requirements = []
|
||||
|
||||
@ -43,6 +43,6 @@ setup(
|
||||
test_suite='tests',
|
||||
tests_require=test_requirements,
|
||||
url='https://github.com/eeriks/erepublik/',
|
||||
version='0.21.4.8',
|
||||
version='0.21.5',
|
||||
zip_safe=False,
|
||||
)
|
||||
|
Reference in New Issue
Block a user