Forum rules
Under no circumstances is spamming or advertising of any kind allowed. Do not post any abusive, obscene, vulgar, slanderous, hateful, threatening, sexually-orientated or any other material that may violate others security. Profanity or any kind of insolent behavior to other members (regardless of rank) will not be tolerated. Remember, what you don’t find offensive can be offensive to other members. Please treat each other with the kind of reverence you’d expect from other members.
Failure to comply with any of the above will result in users being banned without notice. If any further details are needed, contact: “The team” using the link at the bottom of the forum page. Thank you.
tim97
Posts: 3
Joined: Sat Oct 28, 2023 11:21 am

403 errors

Sat Oct 28, 2023 11:27 am

Hi,

For the past couple of days I have been getting 403 responses when using my Python script to perform GET requests. I made a new consumer for a new API key and performed login operations again to gain a new access token, but no success. I also tried the same operation via the stoplight docs, then it does work. I then copied the example code from the spotlight docs and executed that, but still only get 403 errors.

User avatar
oss
Site Admin
Posts: 5890
Joined: Sat Feb 25, 2006 11:26 pm
Contact: Website

Re: 403 errors

Sat Oct 28, 2023 1:46 pm

Hi

can you show your response including headers ? Did you set up Http User Agent ?

tim97
Posts: 3
Joined: Sat Oct 28, 2023 11:21 am

Re: 403 errors

Sat Oct 28, 2023 4:48 pm

Hi,

My GET headers are as follows:

Code: Select all

headers = { 'User-Agent': "MyApp", 'Api-Key': f"apiKey" }
With this being the url

Code: Select all

https://api.opensubtitles.com/api/v1/subtitles?imdb_id=tt4635276&languages=en&season_number=1&episode_number=8
And the response:

Code: Select all

<Response [403]>
And the response headers:

Code: Select all

{'Date': 'Sat, 28 Oct 2023 14:44:58 GMT', 'Content-Type': 'text/html; charset=utf-8', 'Transfer-Encoding': 'chunked', 'Connection': 'keep-alive', 'X-Varnish': '112863781', 'Retry-After': '5', 'CF-Cache-Status': 'BYPASS', 'Report-To': '{"endpoints":[{"url":"https:\\/\\/a.nel.cloudflare.com\\/report\\/v3?s=sMTwlnKIHzW2S3Hluxkg047wrO05Yf0%2Br3WETTeY6ifvek2it%2B%2BuUs%2FX1oZyerRcYi%2BfumwfEDTT0JxWxQ6cDk0EaB5PPAx8IDJNc97Vh3SeAPfAleg6RbYGsHYAl5gsv1tLTJFZcpjamzGlFrxH5j88jzw%3D"}],"group":"cf-nel","max_age":604800}', 'NEL': '{"success_fraction":0,"report_to":"cf-nel","max_age":604800}', 'Vary': 'Accept-Encoding', 'Strict-Transport-Security': 'max-age=15552000; includeSubDomains; preload', 'X-Content-Type-Options': 'nosniff', 'Server': 'cloudflare', 'CF-RAY': '81d3f5ba7bee6664-AMS', 'Content-Encoding': 'gzip', 'alt-svc': 'h3=":443"; ma=86400'}
Because the GET request via the stoplight docs did work I thought it might be IP address related. But via a VPN I get the same result.

User avatar
oss
Site Admin
Posts: 5890
Joined: Sat Feb 25, 2006 11:26 pm
Contact: Website

Re: 403 errors

Sun Oct 29, 2023 5:29 pm

Hi

Try to put instead "myapp" which is used as example your real name of application, like "My cool Downloader v0.1"

tim97
Posts: 3
Joined: Sat Oct 28, 2023 11:21 am

Re: 403 errors

Sun Oct 29, 2023 6:10 pm

Wow, now it does work, thanks!. Why would this all of a sudden make a difference? My headers have been the same since I started developing a couple of weeks ago.

User avatar
oss
Site Admin
Posts: 5890
Joined: Sat Feb 25, 2006 11:26 pm
Contact: Website

Re: 403 errors

Mon Oct 30, 2023 12:47 pm

Hi

it is because we changed it. We want developers use REAL APPLICATION NAME in headers, not example in our docs.

Return to “Developing”

Who is online

Users browsing this forum: No registered users and 17 guests