fix(patreon): declare aiohttp/yarl deps and use public yarl.URL import
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -12,6 +12,7 @@ import os
|
||||
from typing import Optional
|
||||
|
||||
import aiohttp
|
||||
from yarl import URL
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
@@ -42,7 +43,7 @@ def _load_cookie_jar(cookies_path: Optional[str]) -> Optional[aiohttp.CookieJar]
|
||||
for cookie in moz:
|
||||
jar.update_cookies(
|
||||
{cookie.name: cookie.value},
|
||||
response_url=aiohttp.helpers.URL(
|
||||
response_url=URL(
|
||||
f"https://{cookie.domain.lstrip('.')}/"
|
||||
),
|
||||
)
|
||||
|
||||
@@ -13,6 +13,10 @@ alembic
|
||||
celery[redis]
|
||||
redis
|
||||
|
||||
# HTTP client
|
||||
aiohttp
|
||||
yarl
|
||||
|
||||
# Utilities
|
||||
pydantic
|
||||
pydantic-settings
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
"""Unit tests for the Patreon campaign-ID resolver."""
|
||||
import asyncio
|
||||
|
||||
import aiohttp
|
||||
import pytest
|
||||
from aioresponses import aioresponses
|
||||
|
||||
from app.services.patreon_resolver import resolve_campaign_id
|
||||
@@ -55,7 +56,6 @@ async def test_network_error_returns_none():
|
||||
|
||||
|
||||
async def test_timeout_returns_none():
|
||||
import asyncio
|
||||
with aioresponses() as mock:
|
||||
mock.get(CAMPAIGNS_URL, exception=asyncio.TimeoutError())
|
||||
result = await resolve_campaign_id("mstsu", cookies_path=None)
|
||||
|
||||
Reference in New Issue
Block a user