为Unicode(IDNA)域支持修补ssl.match_hostname
idna_ssl的Python项目详细描述
info: | Patch ssl.match_hostname for Unicode(idna) domains support |
---|
安装
pip install idna-ssl
用法
fromidna_sslimportpatch_match_hostname# noqa isort:skippatch_match_hostname()# noqa isort:skipimportasyncioimportaiohttpURL='https://цфоут.мвд.рф/news/item/8065038/'asyncdefmain():asyncwithaiohttp.ClientSession()assession:asyncwithsession.get(URL)asresponse:print(response)loop=asyncio.get_event_loop()loop.run_until_complete(main())
动机
- 这里是100%向后能力
- 相关的aiohttpissue
- 相关的pythonbug
- 相关的python pull request
- 在即将到来的Python3.7中,它是固定的(到2018年1月27日),但是IDNA2008仍然是坏的