我正在尝试从受保护的终结点检索链接数据。我使用了相同的凭据和配置变量,它们在YASGUI中成功返回结果,在Python中出现错误。错误是: EndPointInternalError: endpoint返回代码500和响应。
代码是:
import rdflib
from SPARQLWrapper import SPARQLWrapper, JSON, POST, BASIC, DIGEST, XML
sparql = SPARQLWrapper("")
sparql.setHTTPAuth(BASIC)
sparql.setCredentials("user","pwd")
sparql.setMethod(POST)
sparql.setQuery("""
PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
PREFIX base: <https://w3id.org/def/basicsemantics-owl#>
PREFIX sh: <http://www.w3.org/ns/shacl#>
PREFIX skos: <http://www.w3.org/2004/02/skos/core#>
PREFIX owl: <http://www.w3.org/2002/07/owl#>
SELECT ?subject ?subject_label ?aspect ?aspect_label
WHERE
{
?subject rdfs:subClassOf/owl:onProperty ?aspect .
?subject skos:prefLabel ?subject_label .
?aspect skos:prefLabel ?aspect_label .
}
""")
sparql.setReturnFormat(JSON)
results = sparql.query().convert()
print(results)我用Fiddler追踪了那个电话。似乎潜在的问题与证书有关。当前的错误是: URLError:。这里和那里谷歌,它建议我应该运行Python安装certificates.command。但是,这在我的Python文件夹中不可用。我使用的是Python 3.8
发布于 2020-12-03 06:16:00
HTTP错误500表示服务器出现故障。
常见的响应消息是“内部服务器错误”。
这不是呼叫者的错。
大致如下:
4xx -客户端出现故障
5xx -服务器出现故障
https://stackoverflow.com/questions/65115710
复制相似问题