TypeError: Constructor parameter should be str

原因:在asyncio和aiohttp请求时用的代理的格式错误了。

在requests请求中,代理proxies需要是字典格式,例如{"http": "http://14.67.8.20:2045"},但是在下面的里面需要proxy为字符串类型,例如:

async with session.get(url, proxy="http://14.67.8.20:2045") as response:
return await response.text()
posted @ 2020-12-03 16:35  乔儿  阅读(2687)  评论(0)    收藏  举报