跳至主要内容

修复 ssl.match_hostname 以支持 Unicode(idna) 域名

项目描述

info:

修复 ssl.match_hostname 以支持 Unicode(idna) 域名

https://travis-ci.cn/aio-libs/idna-ssl.svg?branch=master https://img.shields.io/pypi/v/idna_ssl.svg https://codecov.io/gh/aio-libs/idna-ssl/branch/master/graph/badge.svg

安装

pip install idna-ssl

用法

from idna_ssl import patch_match_hostname  # noqa isort:skip
patch_match_hostname()  # noqa isort:skip

import asyncio

import aiohttp

URL = 'https://цфоут.мвд.рф/news/item/8065038/'


async def main():
    async with aiohttp.ClientSession() as session:
        async with session.get(URL) as response:
            print(response)


loop = asyncio.get_event_loop()
loop.run_until_complete(main())

动机

  • 这里100%向后兼容

  • 相关 aiohttp 问题

  • 相关 Python 错误

  • 相关 Python 拉取请求

  • 该问题已修复(截至2018年1月27日),但在即将发布的 Python 3.7 中IDNA2008 仍存在问题

感谢

此库由 Ocean S.A. 赞助

感谢公司对该项目的贡献。

项目详情


下载文件

下载适用于您平台的文件。如果您不确定选择哪个,请了解更多关于安装包的信息。

源分布

idna-ssl-1.1.0.tar.gz (3.4 kB 查看哈希值)

上传时间

支持者