当前位置: 首页>>代码示例>>Python>>正文


Python URL.url_decode方法代码示例

本文整理汇总了Python中core.data.parsers.url.URL.url_decode方法的典型用法代码示例。如果您正苦于以下问题:Python URL.url_decode方法的具体用法?Python URL.url_decode怎么用?Python URL.url_decode使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在core.data.parsers.url.URL的用法示例。


在下文中一共展示了URL.url_decode方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: test_decode_encode

# 需要导入模块: from core.data.parsers.url import URL [as 别名]
# 或者: from core.data.parsers.url.URL import url_decode [as 别名]
 def test_decode_encode(self):
     '''Encode and Decode should be able to run one on the result of the
     other and return the original'''
     original = URL(u'https://w3af.com:443/file.asp?id=1%202')
     decoded = original.url_decode()
     encoded = decoded.url_encode()
     self.assertEqual(original.url_encode(), encoded)
开发者ID:Adastra-thw,项目名称:w3af,代码行数:9,代码来源:test_url.py

示例2: from_httplib_resp

# 需要导入模块: from core.data.parsers.url import URL [as 别名]
# 或者: from core.data.parsers.url.URL import url_decode [as 别名]
 def from_httplib_resp(cls, httplibresp, original_url=None):
     '''
     Factory function. Build a HTTPResponse object from a httplib.HTTPResponse
     instance
 
     :param httplibresp: httplib.HTTPResponse instance
     :param original_url: Optional 'url_object' instance.
 
     :return: A HTTPResponse instance
     '''
     resp = httplibresp
     code, msg, hdrs, body = (resp.code, resp.msg, resp.info(), resp.read())
     hdrs = Headers(hdrs.items())
 
     if original_url:
         url_inst = URL(resp.geturl(), original_url.encoding)
         url_inst = url_inst.url_decode()
     else:
         url_inst = original_url = URL(resp.geturl())
 
     
     if isinstance(resp, urllib2.HTTPError):
         # This is possible because in errors.py I do:
         # err = urllib2.HTTPError(req.get_full_url(), code, msg, hdrs, resp)
         charset = getattr(resp.fp, 'encoding', None)
     else:
         # The encoding attribute is only set on CachedResponse instances
         charset = getattr(resp, 'encoding', None)
     
     return cls(code, body, hdrs, url_inst, original_url,
                msg, charset=charset)
开发者ID:Adastra-thw,项目名称:w3af,代码行数:33,代码来源:HTTPResponse.py

示例3: from_httplib_resp

# 需要导入模块: from core.data.parsers.url import URL [as 别名]
# 或者: from core.data.parsers.url.URL import url_decode [as 别名]
 def from_httplib_resp(cls, httplibresp, original_url=None):
     '''
     Factory function. Build a HTTPResponse object from a httplib.HTTPResponse
     instance
 
     :param httplibresp: httplib.HTTPResponse instance
     :param original_url: Optional 'url_object' instance.
 
     :return: A HTTPResponse instance
     '''
     resp = httplibresp
     code, msg, hdrs, body = (resp.code, resp.msg, resp.info(), resp.read())
     hdrs = Headers(hdrs.items())
 
     if original_url:
         url_inst = URL(resp.geturl(), original_url.encoding)
         url_inst = url_inst.url_decode()
     else:
         url_inst = original_url = URL(resp.geturl())
 
     charset = getattr(resp, 'encoding', None)
     return cls(code, body, hdrs, url_inst, original_url,
                msg, charset=charset)
开发者ID:anemic,项目名称:w3af,代码行数:25,代码来源:HTTPResponse.py


注:本文中的core.data.parsers.url.URL.url_decode方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。