@@ -109,7 +109,7 @@ async def fetch_news(self, symbols: list[str] | None = None, since: datetime | N
109109 if self .cookies :
110110 headers ["Cookie" ] = self .cookies
111111
112- async with httpx .AsyncClient (timeout = 8 , headers = headers ) as client :
112+ async with httpx .AsyncClient (timeout = 8 , headers = headers , trust_env = False ) as client : # CN 源直连,绕过 env 代理
113113 tasks = [self ._fetch_for_symbol (client , symbol , since ) for symbol in a_share_symbols ]
114114 results = await asyncio .gather (* tasks , return_exceptions = True )
115115
@@ -284,7 +284,7 @@ async def fetch_with_limit(client, symbol, stock_name):
284284 "Referer" : "https://so.eastmoney.com/" ,
285285 "Accept" : "*/*" ,
286286 }
287- async with httpx .AsyncClient (timeout = 8 , verify = False , headers = headers ) as client :
287+ async with httpx .AsyncClient (timeout = 8 , verify = False , headers = headers , trust_env = False ) as client : # CN 源直连,绕过 env 代理
288288 tasks = [
289289 fetch_with_limit (client , symbol , symbol_names .get (symbol , symbol ))
290290 for symbol in symbols
@@ -323,7 +323,7 @@ async def fetch_by_keyword(self, keyword: str) -> list[NewsItem]:
323323 "Referer" : "https://so.eastmoney.com/" ,
324324 "Accept" : "*/*" ,
325325 }
326- async with httpx .AsyncClient (timeout = 8 , verify = False , headers = headers ) as client :
326+ async with httpx .AsyncClient (timeout = 8 , verify = False , headers = headers , trust_env = False ) as client : # CN 源直连,绕过 env 代理
327327 return await self ._fetch_for_symbol (client , keyword , keyword , None )
328328
329329 async def _fetch_for_symbol (self , client : httpx .AsyncClient , symbol : str , stock_name : str , since : datetime | None ) -> list [NewsItem ]:
@@ -482,7 +482,7 @@ async def fetch_news(self, symbols: list[str] | None = None, since: datetime | N
482482 }
483483
484484 try :
485- async with httpx .AsyncClient (timeout = 5 , verify = False ) as client :
485+ async with httpx .AsyncClient (timeout = 5 , verify = False , trust_env = False ) as client : # CN 源直连,绕过 env 代理
486486 resp = await client .get (self .API_URL , params = params )
487487 resp .raise_for_status ()
488488 data = resp .json ()
0 commit comments