guba
This commit is contained in:
+38
@@ -0,0 +1,38 @@
|
||||
import asyncio
|
||||
import aiohttp
|
||||
|
||||
comment_headers = {
|
||||
'Accept': '*/*',
|
||||
'Accept-Language': 'zh-CN,zh;q=0.9,en;q=0.8,en-GB;q=0.7,en-US;q=0.6',
|
||||
'Cache-Control': 'no-cache',
|
||||
'Connection': 'keep-alive',
|
||||
'Content-Type': 'application/x-www-form-urlencoded',
|
||||
'Origin': 'https://guba.eastmoney.com',
|
||||
'Pragma': 'no-cache',
|
||||
'Referer': 'https://guba.eastmoney.com/news,002624,1711407668.html',
|
||||
'Sec-Fetch-Dest': 'empty',
|
||||
'Sec-Fetch-Mode': 'cors',
|
||||
'Sec-Fetch-Site': 'same-origin',
|
||||
'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/148.0.0.0 Safari/537.36',
|
||||
}
|
||||
|
||||
async def test_comment_api():
|
||||
url = 'https://guba.eastmoney.com/api/getData?code=002624&path=reply/api/Reply/ArticleNewReplyList'
|
||||
|
||||
payload = {
|
||||
'param': 'postid=1711407668&sort=1&sorttype=1&p=1&ps=30',
|
||||
'plat': 'Web',
|
||||
'path': 'reply/api/Reply/ArticleNewReplyList',
|
||||
'env': '2',
|
||||
'origin': '',
|
||||
'version': '2022',
|
||||
'product': 'Guba'
|
||||
}
|
||||
|
||||
async with aiohttp.ClientSession() as session:
|
||||
async with session.post(url, headers=comment_headers, data=payload) as response:
|
||||
print(f'状态码: {response.status}')
|
||||
text = await response.text()
|
||||
print(f'响应内容:\n{text}')
|
||||
|
||||
asyncio.run(test_comment_api())
|
||||
Reference in New Issue
Block a user