构建一个scraper以异步刮取多个页面。我创建了一个类,但一旦我想要运行测试方法,我就会收到2个错误:
TypeError: 'coroutine' object is not callable
sys:1: RuntimeWarning: coroutine 'Scraper.page' was never awaited
这是我的密码:
from requests_html import AsyncHTMLSession
class Scraper(AsyncHTMLSession):
def __init__(self):
AsyncHTMLSession.__init__(self)
async def page(self):
t = await self.get("https://www.somePage.pl/strona/1/")
if __name__ == "__main__":
t = Scraper()
d1 = t.run(t.page())
print(d1.result)
目前没有回答
相关问题 更多 >
编程相关推荐