Example scripts for uploading and downloading geodata from the GAIA GeoDataLake, using the CKAN API, OAuth2 authentication, and RabbitMQ notifications.
Requires Python >= 3.13 and uv.
uv syncCopy the template and fill in your credentials:
cp envs/env.template .envThe .env file must contain the following variables:
| Variable | Default | Description |
|---|---|---|
PROJECT |
gaia |
Project name (lowercase, no stopwords) |
CKAN_URL |
https://datalake.gaia-project.cloud |
GeoDataLake API base URL |
OAUTH_URL |
https://auth.gaia-project.cloud |
OAuth2 / FusionAuth base URL |
OAUTH_USERNAME |
— | Your username |
OAUTH_PASSWORD |
— | Your password |
OAUTH_API_KEY |
— | API key (provided separately) |
OAUTH_APP_ID |
— | Application ID (provided separately) |
RMQ_HOSTNAME |
bus.gaia-project.cloud |
RabbitMQ hostname |
RMQ_PORT |
5671 |
RabbitMQ TLS port |
RMQ_VHOST |
example |
RabbitMQ virtual host |
RMQ_EXCHANGE |
amq.topic |
RabbitMQ topic exchange name |
RMQ_QUEUE |
qexample.geodatalake |
RabbitMQ queue name |
RMQ_USERNAME |
— | RabbitMQ username |
RMQ_PASSWORD |
— | RabbitMQ password |
RMQ_CA_FILE |
(optional) | Path to the CA certificate PEM file |
The example uploads a mock dataset from data/datasets/NameDataset/.
- INSPIRE metadata:
data/metadataINSPIRE_NameDataset.json— a JSON dict with all fields compliant to the INSPIRE metadata guidelines. All values are strings exceptspatial, which holds a GeoJSON geometry. - Per-resource metadata:
data/datasets/NameDataset_resource_metadata/— one.jsonfile per dataset file describing temporal validity, datatype ID, format, etc.
The upload runs in two steps:
- Upload the INSPIRE metadata package.
- Iteratively upload dataset files, each attached to the metadata package. If any upload fails the metadata package is deleted automatically.
uv run tools/upload.pyWhen a new resource is uploaded, the repository automatically sends a notification to the messaging bus. The download script:
- Simulates sending a notification to the bus (for testing — this step is not needed in production).
- Connects to the queue and listens for notifications.
- Downloads each notified resource to
outputs/.
uv run tools/download.pyPress
Ctrl-Cto stop listening.
tools/rabbitmq.py is a lightweight connectivity smoke test. It connects to the broker, binds the configured queue to the exchange with a hello.# routing key, publishes a test message, and consumes it back. Useful to verify credentials and TLS configuration before running the main scripts.
uv run tools/rabbitmq.py