# Authentication error

**URL:** <https://community.stardog.com/t/authentication-error/986>\
**Category:** Support\
**Created:** [May 8, 2018, 11:02am UTC](https://community.stardog.com/t/authentication-error/986 "2018-05-08T11:02:54Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![navratan22jan](https://avatars.discourse-cdn.com/v4/letter/n/65b543/32.png) [@navratan22jan](https://community.stardog.com/u/navratan22jan)\
**Post date:** [May 8, 2018, 11:02am UTC](https://community.stardog.com/t/authentication-error/986/1 "2018-05-08T11:02:55Z")

</div>

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](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

Thanks

---

<div class="post-metadata">

**Author:** ![stephen](https://yyz2.discourse-cdn.com/flex030/user_avatar/community.stardog.com/stephen/32/27_2.png) [@stephen](https://community.stardog.com/u/stephen)\
**Post date:** [May 8, 2018, 11:57am UTC](https://community.stardog.com/t/authentication-error/986/2 "2018-05-08T11:57:50Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![navratan22jan](https://avatars.discourse-cdn.com/v4/letter/n/65b543/32.png) [@navratan22jan](https://community.stardog.com/u/navratan22jan)\
**Post date:** [May 9, 2018, 3:12am UTC](https://community.stardog.com/t/authentication-error/986/3 "2018-05-09T03:12:17Z")

</div>

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.

Thanks

---

<div class="post-metadata">

**Author:** ![stephen](https://yyz2.discourse-cdn.com/flex030/user_avatar/community.stardog.com/stephen/32/27_2.png) [@stephen](https://community.stardog.com/u/stephen)\
**Post date:** [May 9, 2018, 1:48pm UTC](https://community.stardog.com/t/authentication-error/986/4 "2018-05-09T13:48:03Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex030/uploads/stardog/original/2X/e/ed66b48a616f505106a4acde3c9cee7e6da9bc67.svg) [@system](https://community.stardog.com/u/system)\
**Post date:** [May 23, 2018, 1:59pm UTC](https://community.stardog.com/t/authentication-error/986/5 "2018-05-23T13:59:30Z")

</div>

Closed on May 23, 2018, 1:59pm UTC

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