This is an example confluence page
This page illustrates an example of a Confluence page generated automatically from Python. The code to generate this page can be found here: /home/ecm2892/repos/test_folder/generate_confluence_page/generate_confluence_page.py
Creating Your Personal Confluence API Token
You will need your own personal Confluence API token to create automated pages. Click below to follow the steps to generate a Personal Access Token.
| Expand |
|---|
| title | How to Create and Use Your Personal Confluence API Token |
|---|
|
How to create a Confluence API token (Personal Access Token)- Log in to ECMWF Confluence.
- Click your profile icon in the top-right corner.
- Choose Settings → Personal Access Tokens.
- Click Create token.
- Enter a short name (e.g. Python page generator) and, if asked, set an expiry date.
- Tick Write content (create / update pages) so the script can publish pages.
- Click Create.
- Copy the generated token and store it safely — it will be shown only once.
| Note |
|---|
Treat your API token like a password. Do not share it publicly or commit it to version control. You can revoke or regenerate your token at any time from Personal Access Tokens in your Confluence profile settings. |
Storing the API Token Securely Instead of hardcoding the token directly in your script, you can store it as an environment variable in your ~/.bashrc file. This allows Python to read it automatically each time you run the script. 1. Add the token to your ~/.bashrc fileexport CONFLUENCE_API_TOKEN="paste_your_token_here"
Then reload your configuration so it becomes active: source ~/.bashrc
The token will now be available in all future terminal sessions. 2. Access the token inside your Python script In your script, import the os module and read the token from the environment variable: import os
API_TOKEN = os.getenv("CONFLUENCE_API_TOKEN")
if not API_TOKEN:
raise ValueError("API token not found. Please set the CONFLUENCE_API_TOKEN environment variable.")
3. Run your script normallypython3 generate_confluence_page.py
|
Aim: TEST
Date: 20251015
glofas_ROC_diagram_threshold_10yr_RP_20251015_event_1_24h.png
...
glofas_peak_duration_error_20251015_event_1_24h.png
...
glofas_peak_magnitude_error_20251015_event_1_24h.png
...
Additional Information
| Expand |
|---|
| title | Click to see details |
|---|
|
This section can be expanded or collapsed. It could contain more plots or more text. Note that ChatGPT is very good at helping with HTML formatting! |
...