Thomas_Vcheck
Thomas_Vcheck

Reputation: 192

How to solve the error 403 when doing requests?

I have to get data as json from a page. But my issue is that you need to be authenticated to the site to be able to see the page. I have an account on the site and I would like to know how to make the authentication or bypass this to be able to make my request, for the moment I have

urllib.error.HTTPError: HTTP Error 403

And here is the code I've made

import urllib.request, json

url =  "https://intra.epitech.eu/planning/"
json_url = urllib.request.urlopen(url)
data = json.loads(json_url.read())
print(data)

Upvotes: 0

Views: 229

Answers (2)

phil
phil

Reputation: 626

The epitech intranet gives access to data only if you are logged in with your epitech account (i'm currently a epitech student building an app linked to the intra).

if you are not logged in to the intra you will get a 403 error (the one you have).

to connect to the intra with your account, you either need to use a autologin link (you can generate one in your intra settings) or register a azure active directory app to be able to log in with office365.

Upvotes: 1

V. Panchenko
V. Panchenko

Reputation: 814

Probably you should use API of this website to get protected data. The fact you have an account does not allows you to get data programmatically.

Upvotes: 0

Related Questions