我想通过从get_daraz函数传递参数来构建异步函数中的链接
from requests_html import AsyncHTMLSession
asession = AsyncHTMLSession()
async def get_daraz_page(keyword, page_no):
template_link = 'https://www.daraz.com.np/catalog/?_keyori=ss&from=input&page={page_no}&q={keyword}&spm=a2a0e.11779170.search.go.287d2d2bVToBsh'
r = await asession.get(template_link)
return r
def getDaraz(search):
results=asession.run(get_daraz_page(search,1))
print (results)
getDaraz("Mouse")
它给了我以下错误:
TypeError: 'coroutine' object is not callable
sys:1: RuntimeWarning: coroutine 'get_daraz_page' was never awaited
谢谢
通过html请求,我没有得到任何链接
我建议使用BeautifulSoup、请求和Json。这是我的密码
这就是结果
相关问题 更多 >
编程相关推荐