test_requests.py 文件源码

python
阅读 36 收藏 0 点赞 0 评论 0

项目:Codeforces-Sublime-Plugin 作者: karunk 项目源码 文件源码
def test_get_auth_from_url(self):
        """Ensures that username and password in well-encoded URI as per
        RFC 3986 are correclty extracted."""
        from requests.utils import get_auth_from_url
        from requests.compat import quote
        percent_encoding_test_chars = "%!*'();:@&=+$,/?#[] "
        url_address = "request.com/url.html#test"
        url = "http://" + quote(
            percent_encoding_test_chars, '') + ':' + quote(
            percent_encoding_test_chars, '') + '@' + url_address
        (username, password) = get_auth_from_url(url)
        assert username == percent_encoding_test_chars
        assert password == percent_encoding_test_chars
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号