'RuntimeWarning: unknown response content type 'text/html' returning raw response

I tried to use apache jena fuseki in my python code so I found this: https://sparqlwrapper.readthedocs.io/en/latest/main.html

I followed the first example and here is my code:

pip install sparqlwrapper
from SPARQLWrapper import SPARQLWrapper, JSON
sparql = SPARQLWrapper("http://localhost:3030/dataset.html")
sparql.setQuery("""
    PREFIX ahpo: <http://e-hp.ahp-numerique.fr/ahpo#>
    PREFIX dcterms: <http://purl.org/dc/terms/>
    SELECT ?letter ?corres ?writingDate
    WHERE {
    ?letter ahpo:sentBy <http://henripoincare.fr/api/items/843>
    ?letter ahpo:sentTo ?y
    ?y dcterms:title ?corres
    ?letter ahpo:writingDate ?writingDate
    ?letter ahpo:citeName <http://henripoincare.fr/api/items/333> }  
    LIMIT 50                                                             
""")
sparql.setReturnFormat(JSON)
results = sparql.query().convert()

And I got this Error: /home/issam/anaconda3/lib/python3.9/site-packages/SPARQLWrapper/Wrapper.py:1346: RuntimeWarning: unknown response content type 'text/html' returning raw response... warnings.warn("unknown response content type '%s' returning raw response..." %(ct), RuntimeWarning)

Any solutions ?

Thanks



Solution 1:[1]

The answer has been already given in the comments under the question, but let me generalize the solution a bit. According to the nice presentation about triple stores, Apache Jena Fuseki uses the following endpoint URLs:

# Read (GET/POST):
http://localhost:3030/MyDB/query
http://localhost:3030/MyDB/sparql

# Update (POST):
http://localhost:3030/MyDB/update 

You can always check what your current setup provides on Fuseki's web GUI:

  • Open http://localhost:3030/ in your browser and navigate to the Info page of your dataset.
  • Available services and their exact URLs should be listed there.

(The above is true at least for Apache Jena Fuseki 4.2 or 4.4)

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1