|
@@ -37,27 +37,6 @@ async def get_article_detail(
|
|
|
response = await http_client.post(target_url, headers=headers, data=payload)
|
|
|
|
|
|
return response
|
|
|
- # try:
|
|
|
- # response = requests.post(
|
|
|
- # url=target_url, headers=headers, data=payload, timeout=120
|
|
|
- # )
|
|
|
- # response.raise_for_status()
|
|
|
- # return response.json()
|
|
|
- # except requests.exceptions.RequestException as e:
|
|
|
- # log(
|
|
|
- # task="get_official_article_detail",
|
|
|
- # function="get_official_article_detail",
|
|
|
- # message=f"API请求失败: {e}",
|
|
|
- # data={"link": article_link},
|
|
|
- # )
|
|
|
- # except json.JSONDecodeError as e:
|
|
|
- # log(
|
|
|
- # task="get_official_article_detail",
|
|
|
- # function="get_official_article_detail",
|
|
|
- # message=f"响应解析失败: {e}",
|
|
|
- # data={"link": article_link},
|
|
|
- # )
|
|
|
- # return None
|
|
|
|
|
|
|
|
|
@retry(**retry_desc)
|
|
@@ -67,27 +46,6 @@ async def get_article_list_from_account(account_id: str, index=None) -> dict | N
|
|
|
async with AsyncHttpClient(timeout=120) as http_client:
|
|
|
response = await http_client.post(target_url, headers=headers, data=payload)
|
|
|
return response
|
|
|
- # try:
|
|
|
- # response = requests.post(
|
|
|
- # url=target_url, headers=headers, data=payload, timeout=120
|
|
|
- # )
|
|
|
- # response.raise_for_status()
|
|
|
- # return response.json()
|
|
|
- # except requests.exceptions.RequestException as e:
|
|
|
- # log(
|
|
|
- # task="get_official_account_article_list",
|
|
|
- # function="get_official_account_article_list",
|
|
|
- # message=f"API请求失败: {e}",
|
|
|
- # data={"gh_id": account_id},
|
|
|
- # )
|
|
|
- # except json.JSONDecodeError as e:
|
|
|
- # log(
|
|
|
- # task="get_official_account_article_list",
|
|
|
- # function="get_official_account_article_list",
|
|
|
- # message=f"响应解析失败: {e}",
|
|
|
- # data={"gh_id": account_id},
|
|
|
- # )
|
|
|
- # return None
|
|
|
|
|
|
|
|
|
@retry(**retry_desc)
|
|
@@ -135,7 +93,6 @@ def get_source_account_from_article(article_link) -> dict | None:
|
|
|
async def weixin_search(keyword: str, page="1") -> dict | None:
|
|
|
url = "{}/keyword".format(base_url)
|
|
|
payload = json.dumps({"keyword": keyword, "cursor": page})
|
|
|
- # response = requests.request("POST", url, headers=headers, data=payload, timeout=120)
|
|
|
async with AsyncHttpClient(timeout=120) as http_client:
|
|
|
response = await http_client.post(url=url, headers=headers, data=payload)
|
|
|
|