SPARQLWrapper - EndPointInternalError: endpoint returned code 500 and response

678 views Asked by At

I'm trying to retrieve linked data from an endpoint which is secured. I've used the same credentials and configuration variables which successfully return results in YASGUI gives an error in Python. The error is: EndPointInternalError: endpoint returned code 500 and response.

The code is:

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)

I've used Fiddler to trace the call. It seems the underlying problem has something to do with certificates. The error currently is: URLError: <urlopen error [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certificate (_ssl.c:1108)>. Googled here and there and it is suggested that I should run a Python install certificates.command. However, this is not available in my Python folder. I'm using Python 3.8

1

There are 1 answers

0
AndyS On

An HTTP error of 500 means the server is failing.

The common response message is "Internal Server Error".

It's not the caller's fault.

Roughly:

4xx - client at fault
5xx - server at fault