From 9d90e9fc6dcb0f3377aeefe0378571f0dfa96707 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9C=AA=E6=9D=A5=E5=8F=AF=E6=AC=BA?= <2513502304@qq.com> Date: Thu, 31 Jul 2025 22:01:48 +0800 Subject: [PATCH] =?UTF-8?q?fix=20issue=20#689=EF=BC=8C=E7=9B=AE=E5=89=8D?= =?UTF-8?q?=E6=9D=A5=E7=9C=8B=EF=BC=8C=E5=BA=94=E8=AF=A5=E6=98=AF=20httpx?= =?UTF-8?q?=20=E5=BA=93=E7=9A=84=E9=97=AE=E9=A2=98=EF=BC=8C=E5=9B=A0?= =?UTF-8?q?=E4=B8=BA=E6=97=A0=E8=AE=BA=E6=98=AF=E4=BD=BF=E7=94=A8=E5=90=8C?= =?UTF-8?q?=E6=AD=A5=E8=BF=98=E6=98=AF=E5=BC=82=E6=AD=A5=E7=89=88=E6=9C=AC?= =?UTF-8?q?=EF=BC=8C=E6=9E=84=E4=B8=8D=E6=9E=84=E9=80=A0=20httpx.***Client?= =?UTF-8?q?=20=E5=AF=B9=E8=B1=A1=E6=9D=A5=E5=8F=91=E8=B5=B7=E8=AF=B7?= =?UTF-8?q?=E6=B1=82=EF=BC=8C=E8=BF=94=E5=9B=9E=E7=9A=84=E5=93=8D=E5=BA=94?= =?UTF-8?q?=E9=83=BD=E6=98=AF=E4=B8=BA=E7=A9=BA=EF=BC=8Cresponse.content?= =?UTF-8?q?=20=3D=20b''=EF=BC=8Cresponse.text=20=3D=20=E2=80=99=E2=80=98?= =?UTF-8?q?=EF=BC=8C=E4=BD=86=E6=8D=A2=E6=88=90=20requests=20=E5=BA=93?= =?UTF-8?q?=E5=B0=B1=E8=83=BD=E6=AD=A3=E5=B8=B8=E8=8E=B7=E5=8F=96=E6=95=B0?= =?UTF-8?q?=E6=8D=AE=E4=BA=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- media_platform/douyin/client.py | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/media_platform/douyin/client.py b/media_platform/douyin/client.py index 3106a7d..a788e97 100644 --- a/media_platform/douyin/client.py +++ b/media_platform/douyin/client.py @@ -14,7 +14,7 @@ import json import urllib.parse from typing import Any, Callable, Dict, Union, Optional -import httpx +import requests from playwright.async_api import BrowserContext from base.base_crawler import AbstractApiClient @@ -95,9 +95,7 @@ class DouYinClient(AbstractApiClient): params["a_bogus"] = a_bogus async def request(self, method, url, **kwargs): - response = None - async with httpx.AsyncClient(proxies=self.proxies) as client: - response = await client.request(method, url, timeout=self.timeout, **kwargs) + response = requests.request(method, url, timeout=self.timeout, **kwargs) try: if response.text == "" or response.text == "blocked": utils.logger.error(f"request params incrr, response.text: {response.text}")