我想写一个对日本亚马逊网站的爬虫(需要翻墙),用aiohttp时只报不能连接,ssl:fault信号灯超时的错误。网上能找到的办法已经全部试了一遍,设置超时时间,ssl=False等忽略ssl的方法均无效,有没有佬看看是什么原因,下面是我的测试代码
import aiohttp
import asyncio
async def fetch(url):
async with aiohttp.ClientSession( ) as session:
async with session.get(url) as response:
return await response.text()
async def main():
urls = ['https://www.amazon.co.jp/-/zh/gp/browse.html?node=2230006051&ref_=nav_em__fshn_gane_lf_0_2_12_2','https://www.amazon.co.jp//-/zh/gp/browse.html?node=2230005051&ref_=nav_em__fshn_gane_mf_0_2_12_3','https://www.amazon.co.jp//-/zh/gp/browse.html?node=2230804051&ref_=nav_em__fshn_gane_kf_0_2_12_4']
tasks = [fetch(url) for url in urls]
results = await asyncio.gather(*tasks)
for result in results:
print(result)
loop = asyncio.get_event_loop()
loop.run_until_complete(main())