net.py 文件源码

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

项目:TA-SyncKVStore 作者: georgestarcher 项目源码 文件源码
def validate_(self, value, context=None):
        url = self.valid_url(value)
        if not url:
            raise StopValidationError(self.messages['invalid_url'])
        if self.verify_exists:
            url_string = urlquote(urlunsplit((
                url['scheme'],
                (url['host6'] or url['host4'] or url['hostn_enc']) + ':' + (url['port'] or ''),
                url['path'],
                url['query'],
                url['frag'])
                ).encode('utf-8'), safe=VALID_CHAR_STRING)
            try:
                urlopen(url_string)
            except URLError:
                raise StopValidationError(self.messages['not_found'])
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号