I'm New to Fuseki and Sparql.
I was looking at this post --> query a fuseki server using python (or something)
Where one of the solutions was to use requests
Here is my code, but the query is unsuccessful!
import requests
query = '''
SELECT ?subject ?predicate ?object
WHERE {
GRAPH <ma_graph.ttl>{
?subject ?predicate ?object.
{
}
LIMIT 25
'''
response = requests.post('http://localhost:3030/#/dataset/fusekiservice/query',
data={'query': query})
if response.status_code == 200:
print("Successfully accessed the page.")
try:
json_response = response.json()
print(json_response)
except ValueError:
print("Response is not in JSON format.")
print(response.text)
else:
print(f"Failed to access the page. Status code: {response.status_code}")
I get Failed to access the page. Status code: 405. The output that I expect to see is a list of 25 triplets.
Usually, I use my local PC to access the fuseki, and I query on this page http://localhost:3030/#/dataset/fusekiservice/query with a UI.
However, I'm not sure that I have to request access to that page, and that's what causes the problem.
Edit 1:
As UninformedUser mentioned in the comments I did change the fuseki URL to SPARQL Endpoint that I found in the web UI /fusekiservice/, but it didn't help. I also tried /fusekiservice/query and /fusekiservice/sprql