本文整理汇总了Python中urllib.request.lower函数的典型用法代码示例。如果您正苦于以下问题:Python lower函数的具体用法?Python lower怎么用?Python lower使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了lower函数的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。
示例1: wmts_request_compare_project
def wmts_request_compare_project(self, project, request, version='', extra_query_string='', reference_base_name=None):
query_string = 'https://www.qgis.org/?SERVICE=WMTS&REQUEST=%s' % (request)
if version:
query_string += '&VERSION=%s' % version
if extra_query_string:
query_string += '&%s' % extra_query_string
header, body = self._execute_request_project(query_string, project)
self.assert_headers(header, body)
response = header + body
if reference_base_name is not None:
reference_name = reference_base_name
else:
reference_name = 'wmts_' + request.lower()
reference_name += '.txt'
reference_path = self.testdata_path + reference_name
self.store_reference(reference_path, response)
f = open(reference_path, 'rb')
expected = f.read()
f.close()
response = re.sub(RE_STRIP_UNCHECKABLE, b'', response)
expected = re.sub(RE_STRIP_UNCHECKABLE, b'', expected)
self.assertXMLEqual(response, expected, msg="request %s failed.\n Query: %s" % (query_string, request))
开发者ID:mbernasocchi,项目名称:QGIS,代码行数:28,代码来源:test_qgsserver_wmts.py
示例2: wms_request_compare
def wms_request_compare(self, request, extra=None, reference_file=None):
project = self.testdata_path + "test_project.qgs"
assert os.path.exists(project), "Project file not found: " + project
query_string = 'MAP=%s&SERVICE=WMS&VERSION=1.3&REQUEST=%s' % (urllib.parse.quote(project), request)
if extra is not None:
query_string += extra
header, body = self.server.handleRequest(query_string)
response = header + body
reference_path = self.testdata_path + (request.lower() if not reference_file else reference_file) + '.txt'
f = open(reference_path, 'rb')
expected = f.read()
f.close()
# Store the output for debug or to regenerate the reference documents:
"""
f = open(reference_path, 'wb+')
f.write(response)
f.close()
f = open(os.path.dirname(__file__) + '/expected.txt', 'w+')
f.write(expected)
f.close()
f = open(os.path.dirname(__file__) + '/response.txt', 'w+')
f.write(response)
f.close()
#"""
response = re.sub(RE_STRIP_UNCHECKABLE, b'*****', response)
expected = re.sub(RE_STRIP_UNCHECKABLE, b'*****', expected)
# for older GDAL versions (<2.0), id field will be integer type
if int(osgeo.gdal.VersionInfo()[:1]) < 2:
expected = expected.replace(b'typeName="Integer64" precision="0" length="10" editType="TextEdit" type="qlonglong"', b'typeName="Integer" precision="0" length="10" editType="TextEdit" type="int"')
self.assertXMLEqual(response, expected, msg="request %s failed.\n Query: %s\n Expected:\n%s\n\n Response:\n%s" % (query_string, request, expected.decode('utf-8'), response.decode('utf-8')))
开发者ID:lucacasagrande,项目名称:QGIS,代码行数:34,代码来源:test_qgsserver.py
示例3: wfs_request_compare
def wfs_request_compare(self, request):
project = self.testdata_path + "test_project_wfs.qgs"
assert os.path.exists(project), "Project file not found: " + project
query_string = 'MAP=%s&SERVICE=WFS&VERSION=1.0.0&REQUEST=%s' % (urllib.parse.quote(project), request)
header, body = self.server.handleRequest(query_string)
self.assert_headers(header, body)
response = header + body
f = open(self.testdata_path + 'wfs_' + request.lower() + '.txt', 'rb')
expected = f.read()
f.close()
# Store the output for debug or to regenerate the reference documents:
"""
f = open(os.path.dirname(__file__) + '/wfs_' + request.lower() + '_expected.txt', 'w+')
f.write(expected)
f.close()
f = open(os.path.dirname(__file__) + '/wfs_' + request.lower() + '_response.txt', 'w+')
f.write(response)
f.close()
"""
response = re.sub(RE_STRIP_UNCHECKABLE, b'', response)
expected = re.sub(RE_STRIP_UNCHECKABLE, b'', expected)
# for older GDAL versions (<2.0), id field will be integer type
if int(osgeo.gdal.VersionInfo()[:1]) < 2:
expected = expected.replace(b'<element type="long" name="id"/>', b'<element type="integer" name="id"/>')
self.assertXMLEqual(response, expected, msg="request %s failed.\n Query: %s\n Expected:\n%s\n\n Response:\n%s" % (query_string, request, expected.decode('utf-8'), response.decode('utf-8')))
开发者ID:lucacasagrande,项目名称:QGIS,代码行数:28,代码来源:test_qgsserver.py
示例4: wms_request_compare
def wms_request_compare(self, request, extra=None, reference_file=None):
project = self.testdata_path + "test_project.qgs"
assert os.path.exists(project), "Project file not found: " + project
query_string = 'MAP=%s&SERVICE=WMS&VERSION=1.3&REQUEST=%s' % (urllib.parse.quote(project), request)
if extra is not None:
query_string += extra
header, body = self.server.handleRequest(query_string)
response = header + body
reference_path = self.testdata_path + (request.lower() if not reference_file else reference_file) + '.txt'
f = open(reference_path, 'rb')
expected = f.read()
f.close()
# Store the output for debug or to regenerate the reference documents:
"""
f = open(reference_path, 'wb+')
f.write(response)
f.close()
f = open(os.path.dirname(__file__) + '/expected.txt', 'w+')
f.write(expected)
f.close()
f = open(os.path.dirname(__file__) + '/response.txt', 'w+')
f.write(response)
f.close()
#"""
response = re.sub(RE_STRIP_UNCHECKABLE, b'*****', response)
expected = re.sub(RE_STRIP_UNCHECKABLE, b'*****', expected)
self.assertXMLEqual(response, expected, msg="request %s failed.\n Query: %s\n Expected:\n%s\n\n Response:\n%s" % (query_string, request, expected.decode('utf-8'), response.decode('utf-8')))
开发者ID:wongjimsan,项目名称:QGIS,代码行数:30,代码来源:test_qgsserver.py
示例5: wms_inspire_request_compare
def wms_inspire_request_compare(self, request):
"""WMS INSPIRE tests"""
project = self.testdata_path + "test_project_inspire.qgs"
assert os.path.exists(project), "Project file not found: " + project
query_string = "MAP=%s&SERVICE=WMS&VERSION=1.3.0&REQUEST=%s" % (urllib.parse.quote(project), request)
header, body = self.server.handleRequest(query_string)
response = header + body
f = open(self.testdata_path + request.lower() + "_inspire.txt", "rb")
expected = f.read()
f.close()
# Store the output for debug or to regenerate the reference documents:
"""
f = open(os.path.dirname(__file__) + '/expected.txt', 'w+')
f.write(expected)
f.close()
f = open(os.path.dirname(__file__) + '/response.txt', 'w+')
f.write(response)
f.close()
"""
response = re.sub(RE_STRIP_UNCHECKABLE, b"", response)
expected = re.sub(RE_STRIP_UNCHECKABLE, b"", expected)
self.assertXMLEqual(
response,
expected,
msg="request %s failed.\n Query: %s\n Expected:\n%s\n\n Response:\n%s"
% (query_string, request, expected.decode("utf-8"), response.decode("utf-8")),
)
开发者ID:p0cisk,项目名称:Quantum-GIS,代码行数:28,代码来源:test_qgsserver.py
示例6: wms_request_compare
def wms_request_compare(self, request, extra=None, reference_file=None, project='test_project.qgs', version='1.3.0', ignoreExtent=False, normalizeJson=False):
response_header, response_body, query_string = self.wms_request(request, extra, project, version)
response = response_header + response_body
reference_path = self.testdata_path + (request.lower() if not reference_file else reference_file) + '.txt'
self.store_reference(reference_path, response)
f = open(reference_path, 'rb')
expected = f.read()
def _n(r):
lines = r.split(b'\n')
b = lines[2:]
h = lines[:2]
try:
return b'\n'.join(h) + json.dumps(json.loads(b'\n'.join(b))).encode('utf8')
except:
return r
response = _n(response)
expected = _n(expected)
f.close()
response = re.sub(RE_STRIP_UNCHECKABLE, b'*****', response)
expected = re.sub(RE_STRIP_UNCHECKABLE, b'*****', expected)
if ignoreExtent:
response = re.sub(RE_STRIP_EXTENTS, b'*****', response)
expected = re.sub(RE_STRIP_EXTENTS, b'*****', expected)
msg = "request %s failed.\nQuery: %s\nExpected file: %s\nResponse:\n%s" % (query_string, request, reference_path, response.decode('utf-8'))
self.assertXMLEqual(response, expected, msg=msg)
开发者ID:boundlessgeo,项目名称:QGIS,代码行数:29,代码来源:test_qgsserver_wms.py
示例7: wms_request_compare
def wms_request_compare(self, request, extra=None, reference_file=None, project='test_project.qgs', version='1.3.0'):
response_header, response_body, query_string = self.wms_request(request, extra, project, version)
response = response_header + response_body
reference_path = self.testdata_path + (request.lower() if not reference_file else reference_file) + '.txt'
self.store_reference(reference_path, response)
f = open(reference_path, 'rb')
expected = f.read()
f.close()
response = re.sub(RE_STRIP_UNCHECKABLE, b'*****', response)
expected = re.sub(RE_STRIP_UNCHECKABLE, b'*****', expected)
msg = "request %s failed.\nQuery: %s\nExpected file: %s\nResponse:\n%s" % (query_string, request, reference_path, response.decode('utf-8'))
self.assertXMLEqual(response, expected, msg=msg)
开发者ID:SrNetoChan,项目名称:Quantum-GIS,代码行数:13,代码来源:test_qgsserver_wms.py
示例8: wms_inspire_request_compare
def wms_inspire_request_compare(self, request):
"""WMS INSPIRE tests"""
project = self.testdata_path + "test_project_inspire.qgs"
assert os.path.exists(project), "Project file not found: " + project
query_string = '?MAP=%s&SERVICE=WMS&VERSION=1.3.0&REQUEST=%s' % (urllib.parse.quote(project), request)
header, body = self._execute_request(query_string)
response = header + body
reference_path = self.testdata_path + request.lower() + '_inspire.txt'
self.store_reference(reference_path, response)
f = open(reference_path, 'rb')
expected = f.read()
f.close()
response = re.sub(RE_STRIP_UNCHECKABLE, b'', response)
expected = re.sub(RE_STRIP_UNCHECKABLE, b'', expected)
self.assertXMLEqual(response, expected, msg="request %s failed.\nQuery: %s\nExpected file: %s\nResponse:\n%s" % (query_string, request, reference_path, response.decode('utf-8')))
开发者ID:mj10777,项目名称:QGIS,代码行数:16,代码来源:test_qgsserver_wms.py
示例9: wcs_request_compare
def wcs_request_compare(self, request):
project = self.projectPath
assert os.path.exists(project), "Project file not found: " + project
query_string = '?MAP=%s&SERVICE=WCS&VERSION=1.0.0&REQUEST=%s' % (urllib.parse.quote(project), request)
header, body = self._execute_request(query_string)
self.assert_headers(header, body)
response = header + body
reference_path = self.testdata_path + 'wcs_' + request.lower() + '.txt'
f = open(reference_path, 'rb')
self.store_reference(reference_path, response)
expected = f.read()
f.close()
response = re.sub(RE_STRIP_UNCHECKABLE, b'', response)
expected = re.sub(RE_STRIP_UNCHECKABLE, b'', expected)
self.assertXMLEqual(response, expected, msg="request %s failed.\n Query: %s\n Expected:\n%s\n\n Response:\n%s" % (query_string, request, expected.decode('utf-8'), response.decode('utf-8')))
开发者ID:vmora,项目名称:QGIS,代码行数:17,代码来源:test_qgsserver.py
示例10: wms_request_compare
def wms_request_compare(self, request, extra=None, reference_file=None, project='test_project.qgs'):
project = self.testdata_path + project
assert os.path.exists(project), "Project file not found: " + project
query_string = 'https://www.qgis.org/?MAP=%s&SERVICE=WMS&VERSION=1.3&REQUEST=%s' % (urllib.parse.quote(project), request)
if extra is not None:
query_string += extra
header, body = self._execute_request(query_string)
response = header + body
reference_path = self.testdata_path + (request.lower() if not reference_file else reference_file) + '.txt'
self.store_reference(reference_path, response)
f = open(reference_path, 'rb')
expected = f.read()
f.close()
response = re.sub(RE_STRIP_UNCHECKABLE, b'*****', response)
expected = re.sub(RE_STRIP_UNCHECKABLE, b'*****', expected)
self.assertXMLEqual(response, expected, msg="request %s failed.\nQuery: %s\nExpected file: %s\nResponse:\n%s" % (query_string, request, reference_path, response.decode('utf-8')))
开发者ID:mj10777,项目名称:QGIS,代码行数:18,代码来源:test_qgsserver_wms.py
注:本文中的urllib.request.lower函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论