Authentication error

Hi All,

I am trying to fetch a pdf doc saved in stardog db on the localhost:5820 using python.

I tried the code from the BITES apiary site:
Below is the code:

from urllib2 import Request, urlopen

request = Request(‘http://localhost:5820/cars/docs/whyfp90.pdf’)

response_body = urlopen(request).read()
print response_body

I get the following error - “HTTPError: HTTP Error 401: Unauthorized”

Kindly suggest the solution if any


As with any HTTP request to Stardog, you need to pass in user credentials in order to be authorized. You will need to pass in your Stardog user/password however urilib2 performs basic authentication.

Hi Stephen,

Thanks for the response.
Can you please share a sample code for stardog authentication in python, so that i can try and use it.


You will have to look at the documentation for whatever python library you are using to make the HTTP call, as none of them is developed or maintained by Stardog.

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.