added proxy managament from dsqls module
This commit is contained in:
1 parent
e04909ebad
commit
8f86e85c50
1 file changed
+7
-2
@@ -4,6 +4,7 @@ from datetime import datetime, timedelta, timezone
|
|||||||
from typing import Awaitable, Callable, Iterable
|
from typing import Awaitable, Callable, Iterable
|
||||||
|
|
||||||
import aiohttp
|
import aiohttp
|
||||||
|
from aioproxies import AioProxies
|
||||||
from curl_cffi.requests import AsyncSession
|
from curl_cffi.requests import AsyncSession
|
||||||
from motor.motor_asyncio import AsyncIOMotorCollection
|
from motor.motor_asyncio import AsyncIOMotorCollection
|
||||||
|
|
||||||
@@ -134,6 +135,7 @@ def build_product_details(
|
|||||||
|
|
||||||
|
|
||||||
async def execute_monitor_logic(
|
async def execute_monitor_logic(
|
||||||
|
proxies: AioProxies,
|
||||||
category_identifiers: list[str] | dict[str, str],
|
category_identifiers: list[str] | dict[str, str],
|
||||||
task_func: Callable[..., Awaitable[None]],
|
task_func: Callable[..., Awaitable[None]],
|
||||||
headers: dict | None = None,
|
headers: dict | None = None,
|
||||||
@@ -144,9 +146,12 @@ async def execute_monitor_logic(
|
|||||||
):
|
):
|
||||||
while True:
|
while True:
|
||||||
session_ctx = (
|
session_ctx = (
|
||||||
get_tls_session(headers=headers)
|
get_tls_session(
|
||||||
|
headers=headers,
|
||||||
|
proxies=proxies,
|
||||||
|
)
|
||||||
if use_tls
|
if use_tls
|
||||||
else get_base_session(headers=headers, cookies=cookies)
|
else get_base_session(headers=headers, cookies=cookies, proxies=proxies)
|
||||||
)
|
)
|
||||||
async with session_ctx as session:
|
async with session_ctx as session:
|
||||||
LOGGER.info("Starting tasks...")
|
LOGGER.info("Starting tasks...")
|
||||||
|
|||||||
Reference in new issue
Block a user