Python:为什么我在运行Sparql查询时遇到certifcate错误?

时间:2017-11-13 13:27:18

标签: python sparql sparqlwrapper

我必须运行以下查询

query = """
PREFIX schema: <http://schema.org/>
PREFIX gn: <http://www.geonames.org/ontology#>
select ?Municipality ?Name ?Population
where
{
?Municipality a gn:A.ADM3 .
?Municipality schema:name ?Name .
?Municipality gn:population ?Population .
?Municipality <http://purl.org/dc/terms/issued> ?Date .
FILTER (?Date = "2016-01-01"^^xsd:date)
}
ORDER BY DESC(?Population)
LIMIT 5
"""

如果我在此处https://sparql.geo.admin.ch/sparql运行该查询,则可行,但如果我尝试在Python中运行该问题:

from SPARQLWrapper import SPARQLWrapper, JSON 
sparql = SPARQLWrapper("https://sparql.geo.admin.ch/sparql")  
sparql.setQuery(query)
sparql.setReturnFormat(JSON)
results = sparql.query().convert()

我收到以下错误

URLError: <urlopen error [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed (_ssl.c:590)>

0 个答案:

没有答案