From 447e4680d3daac90d15bc37cf65b67f522b29b36 Mon Sep 17 00:00:00 2001 From: somespecialone Date: Sun, 25 Aug 2024 17:14:01 +0200 Subject: [PATCH] =?UTF-8?q?=F0=9F=9A=91=20Fix:=20create=20a=20new=20`sessi?= =?UTF-8?q?on`=20instead=20of=20passed,=20`proxy`=20property.=20v0.6.2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- aiosteampy/mixins/http.py | 20 +++++++++++--------- poetry.lock | 19 ++++++++++++------- pyproject.toml | 8 ++++---- 3 files changed, 27 insertions(+), 20 deletions(-) diff --git a/aiosteampy/mixins/http.py b/aiosteampy/mixins/http.py index a1004c7..f75d97c 100644 --- a/aiosteampy/mixins/http.py +++ b/aiosteampy/mixins/http.py @@ -123,7 +123,7 @@ def _session_helper(session: ClientSession = None, proxy: str = None) -> ClientS raise TypeError( """ To use `socks` type proxies you need `aiohttp_socks` package. - You can do this with `aiosteampy[socks]` dependency install target. + You can do this with `aiosteampy[socks]` or `aiosteampy[all]` dependency install targets. """ ) @@ -137,24 +137,26 @@ def _session_helper(session: ClientSession = None, proxy: str = None) -> ClientS session = patch_session_with_http_proxy(ClientSession(raise_for_status=True), proxy) - elif session and not session._raise_for_status: - warn( - "A session instance must be created with `raise_for_status=True` for client to work properly", - category=UserWarning, - ) - else: + elif session: + if not session._raise_for_status: + warn( + "A session instance must be created with `raise_for_status=True` for client to work properly", + category=UserWarning, + ) + else: # nothing passed session = ClientSession(raise_for_status=True) return session + # _proxy attr will be much easier, straight and less error-prone, why I need this? @property def proxy(self) -> str | None: """Proxy url in format `scheme://username:password@host:port` or `scheme://host:port`""" - if isinstance(self.session.connector, ProxyConnector): # socks + if isinstance(self.session.connector, ProxyConnector or int): # socks, int to avoid TypeError if None c: ProxyConnector = self.session.connector - scheme = str(c._proxy_type).lower() + scheme = str(c._proxy_type.name).lower() username = c._proxy_username password = c._proxy_password host = c._proxy_host diff --git a/poetry.lock b/poetry.lock index 1e4f861..e928583 100644 --- a/poetry.lock +++ b/poetry.lock @@ -653,13 +653,13 @@ test = ["coverage[toml]", "ddt (>=1.1.1,!=1.4.3)", "mock", "mypy", "pre-commit", [[package]] name = "idna" -version = "3.7" +version = "3.8" description = "Internationalized Domain Names in Applications (IDNA)" optional = false -python-versions = ">=3.5" +python-versions = ">=3.6" files = [ - {file = "idna-3.7-py3-none-any.whl", hash = "sha256:82fee1fc78add43492d3a1898bfa6d8a904cc97d8427f683ed8e798d07761aa0"}, - {file = "idna-3.7.tar.gz", hash = "sha256:028ff3aadf0609c1fd278d8ea3089299412a7a8b9bd005dd08b9f8285bcb5cfc"}, + {file = "idna-3.8-py3-none-any.whl", hash = "sha256:050b4e5baadcd44d760cedbd2b8e639f2ff89bbc7a5730fcc662954303377aac"}, + {file = "idna-3.8.tar.gz", hash = "sha256:d838c2c0ed6fced7693d5e8ab8e734d5f8fda53a039c0164afb0b82e771e3603"}, ] [[package]] @@ -1029,14 +1029,19 @@ files = [ [[package]] name = "paginate" -version = "0.5.6" +version = "0.5.7" description = "Divides large result sets into pages for easier browsing" optional = false python-versions = "*" files = [ - {file = "paginate-0.5.6.tar.gz", hash = "sha256:5e6007b6a9398177a7e1648d04fdd9f8c9766a1a945bceac82f1929e8c78af2d"}, + {file = "paginate-0.5.7-py2.py3-none-any.whl", hash = "sha256:b885e2af73abcf01d9559fd5216b57ef722f8c42affbb63942377668e35c7591"}, + {file = "paginate-0.5.7.tar.gz", hash = "sha256:22bd083ab41e1a8b4f3690544afb2c60c25e5c9a63a30fa2f483f6c60c8e5945"}, ] +[package.extras] +dev = ["pytest", "tox"] +lint = ["black"] + [[package]] name = "pathspec" version = "0.12.1" @@ -1671,4 +1676,4 @@ socks = ["aiohttp-socks"] [metadata] lock-version = "2.0" python-versions = "^3.10" -content-hash = "1dc88988f23a194cf342890bf188c04ea2cd99e2c18bc26705e870597cfedb4d" +content-hash = "59dfacc76326f28f4813332b877d4f5014b9cd70224fd6ff082fff3220b286d9" diff --git a/pyproject.toml b/pyproject.toml index 29dc47d..b6582e5 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [tool.poetry] name = "aiosteampy" -version = "0.6.1" +version = "0.6.2" description = "Trade and interact with steam market, webapi, guard" license = "MIT" authors = ["Dmytro Tkachenko "] @@ -38,9 +38,9 @@ packages = [{ include = "aiosteampy" }] python = "^3.10" aiohttp = "^3.8" rsa = "^4.8" -aenum = ">=3.1.2, <4" -croniter = { version = ">=2, <4", optional = true } -aiohttp-socks = { version = ">=0.8.4, <1", optional = true } +aenum = ">=3.1.2, <4.0.0" +croniter = { version = ">=2.0, <4.0", optional = true } +aiohttp-socks = { version = ">=0.8.4, <1.0.0", optional = true } [tool.poetry.extras] converter = ["croniter"]