Giter Site home page Giter Site logo

Comments (3)

gdams avatar gdams commented on July 28, 2024 1

@johnoliver any ideas here? I can confirm that I'm also seeing the same error when using the above test file

from api.adoptium.net.

netomi avatar netomi commented on July 28, 2024 1

I tested the above snippet and can confirm that I also receive a 403 error.

However, by simply adding a User-Agent header like that:

    import requests

    headers = {
        "User-Agent": "My User Agent 1.0",
    }

    resp = requests.get(
        "https://api.adoptium.net/v3/info/available_releases", headers=headers
    )
    print(resp.request.headers)
    print(resp.headers)
    print(resp.status_code)
    print(resp.text)

the request passes:

{'User-Agent': 'My User Agent 1.0', 'Accept-Encoding': 'gzip, deflate', 'Accept': '*/*', 'Connection': 'keep-alive'}
{'Date': 'Sat, 21 Oct 2023 20:02:31 GMT', 'Content-Type': 'application/json;charset=UTF-8', 'Content-Length': '344', 'Connection': 'keep-alive', 'Strict-Transport-Security': 'max-age=63072000; includeSubDomains; preload', 'X-Content-Type-Options': 'nosniff', 'X-Frame-Options': 'DENY', 'X-Pod-Hostname': 'frontend-service-89db8c5b7-tvvxp'}
200
{ 
   "available_lts_releases": [
        8,
        11,
        17,
        21
    ],
...

from api.adoptium.net.

netomi avatar netomi commented on July 28, 2024

I wonder if its related to the hosting provider, see a similar SO question about cloudflare:

https://stackoverflow.com/questions/74446830/how-to-fix-403-forbidden-errors-with-python-requests-even-with-user-agent-head

This sounds like some protection mechanism against data scraping.

from api.adoptium.net.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.