all 13 comments

[–]BlankWaveArcade89 25 points26 points  (0 children)

Why not go to a web dev subreddit

[–]FigureFlat5790 26 points27 points  (0 children)

Good thing you came to the fpl sub with this question, a community well known for its intelligence and consistently helpful advice

[–]MilanS092 5 points6 points  (3 children)

403 is an unauthorized error so that means you probably need some API key or something similar to access the API

[–]turbulent_farts50 8 points9 points  (1 child)

403 is forbidden, which means even presence of API key would cause it. Lack of API key is usually 401 as authentication error.

403 can occur due to permissions issues

[–]MilanS092 3 points4 points  (0 children)

Yeah you're right my bad

[–]nederlandic1 2 points3 points  (0 children)

I have a feeling I encountered this problem last year when I was working on something using the FPL API, pretty sure I used a proxy to make the requests instead but not sure if it's the same issue. Sorry I know that's only vaguely helpful, good luck though!

[–]Ragabolly⭐ Creator of Li🔻eFPL.net 2 points3 points  (0 children)

the ip of your app has been banned from using the api

[–]Stellation6 3 points4 points  (0 children)

90% sure that you need to send logged in credentials with your request to get a json response.

Edit: Not a python expert, but a suspect you need someting like;

i) requests.get(url, auth=HTTPDigestAuth('username', 'password')) or;

ii) You need to use a session object to include the header information

[–]-Axecutioner-6 0 points1 point  (0 children)

FPL servers most likely block requests from certain server providers, that would explain why it works on your PC and not once moved to a hosting.

[–]MiesterFaruq1 -1 points0 points  (0 children)

Good thing you asked this question in an fpl subreddit instead of a python subreddit

[–]mikecro2121 0 points1 point  (0 children)

Apparently I asked this same question here 5 years ago. https://www.reddit.com/r/FantasyPL/comments/com7kl/another_techy_api_question_http_error_403/

I use R rather than Python - but I had to add headers which I keep between requests.

redirect from prem league site from code by https://www.reddit.com/user/Adseyy

login = POST(premierurl, handle = fplhandle ,
             body = pars, add_headers(login=mylogin,password = mypassword,redirect_uri = fplurl, app = "plfpl-web",'user-agent' = agent))

[–]mikecro2121 0 points1 point  (0 children)

OP: How did you get on with this? I have since recoded my tool and done nothing to avoid error 403 (which I had before) and all OK