一、解决办法
asyncio.set_event_loop_policy(asyncio.WindowsSelectorEventLoopPolicy())
AttributeError: module 'asyncio' has no attribute 'WindowsSelectorEventLoopPolicy'

这个文件夹

tornado/platform/asyncio.py :
import sys

if sys.platform == 'win32':
asyncio.set_event_loop_policy(asyncio.WindowsSelectorEventLoopPolicy())

​https://github.com/tornadoweb/tornado/issues/2751​​ https://www.tornadoweb.org/en/stable/index.html#installation

二、本人出现场景爬虫抓包windos: ​评论区给的是正解切换版本 pip install mitmproxy==5.0.1​

本人装 ​​pip install mitmproxy​​​ 完全ok
启动服务 ​​​mitmdump​​,报如下错误

asyncio.set_event_loop_policy(asyncio.WindowsSelectorEventLoopPolicy())
AttributeError: module 'asyncio' has no attribute 'WindowsSelectorEventLoopPolicy'

​于是我把上面个那个方法进行使用, 加上去了, 针对我这个应用场景然并卵(此处是个坑,下面会讲到)​

解决办法下面文件夹下的代码我给注了.

AttributeError: module ‘asyncio‘ has no attribute ‘WindowsSelectorEventLoopPolicy‘_后端

###### 重新启动服务​​mitmdump​​然后添加证书 手机端 网址 mitm.it 选择对应设备ok抓到相应的包啦

AttributeError: module ‘asyncio‘ has no attribute ‘WindowsSelectorEventLoopPolicy‘_后端_02

你以为ok啦, 如果要求不高,确实ok啦, 实则太难看了

于是我又想进行抓包可视化页面​​mitmweb​​,又tm 报错这个

asyncio.set_event_loop_policy(asyncio.WindowsSelectorEventLoopPolicy())
AttributeError: module 'asyncio' has no attribute 'WindowsSelectorEventLoopPolicy'

于是 这个几个文件加我又看看源码,发现上面原来加上的代码给注释掉,终于运行啦

AttributeError: module ‘asyncio‘ has no attribute ‘WindowsSelectorEventLoopPolicy‘_django_03


AttributeError: module ‘asyncio‘ has no attribute ‘WindowsSelectorEventLoopPolicy‘_django_04

如果对你有帮助,点个赞再走呗

主要我太不容易啦