Skip to content

Commit a6325b6

Browse files
committed
fix
1 parent 521fde2 commit a6325b6

2 files changed

Lines changed: 15 additions & 1 deletion

File tree

pyaterochka_api/manager.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@ async def _warmup(self) -> None:
115115
await self.page.wait_for_load_state("networkidle", timeout=self.timeout_ms)
116116
ok = True
117117
except PWTimeoutError:
118-
await self.page.reload()
118+
await self.page.reload(wait_until="commit")
119119
if not ok:
120120
raise RuntimeError(self.page.content)
121121

tests/api_tests.py

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22
from PIL import Image
33
from pytest_jsonschema_snapshot import SchemaShot
44

5+
import aiohttp
6+
from human_requests.abstraction import Proxy
57
from pyaterochka_api import PyaterochkaAPI
68

79

@@ -158,3 +160,15 @@ async def test_download_image(api: PyaterochkaAPI, first_category: dict):
158160
with Image.open(resp) as img:
159161
fmt = img.format.lower()
160162
assert fmt in ("png", "jpeg", "webp")
163+
164+
async def test_proxy_ip(api: PyaterochkaAPI):
165+
if not api.proxy:
166+
pytest.skip("Proxy not configured")
167+
168+
prx = Proxy(api.proxy)
169+
170+
async with aiohttp.ClientSession() as session:
171+
async with session.get("http://httpbin.org/ip", proxy=prx.as_str()) as resp:
172+
ip = resp.json()["origin"]
173+
174+
assert ip == prx._server.split(":")[0]

0 commit comments

Comments
 (0)