> For the complete documentation index, see [llms.txt](https://kasperisme.gitbook.io/carnot/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://kasperisme.gitbook.io/carnot/guides/forbind-til-api/python.md).

# Python

{% code lineNumbers="true" %}

```python
// Some code
import requests

URL="https://openapi.carnot.dk/openapi/get_predict"

PARAMS={
        "daysahead": 5,
        "energysource": "solarpower",
        "region": "dk1",
      }
      
HEADERS={
        "apikey": "{{ api-key }}",
        "username": "{{ username }}",
      }

r = requests.get(url = URL, params = PARAMS,headers=HEADERS)

data = r.json()

print(data)
```

{% endcode %}
