OSDU tutorials for various use cases in Python
Simple web application demonstrating how to use Authentication, Search and Delivery APIs
- Get client ID, client Secret, Authorization URL and API URL from your platform admin.
- Clone this repository.
- Go to 'quickstart' folder, rename default environment file to config-azure|aws|gcp.env and fill out the values:
# OAuth settings
OSDU_CLIENT_ID=<your-client-id>
OSDU_CLIENT_SECRET=<your-client-secret>
OSDU_AUTH_BASE_URL=<auth-server-url>
# API
OSDU_API_BASE_URL=<api-base-url>
- Download and install Python.
- Create and activate virtual environment:
$ python3 -m venv --prompt quickstart .venv/quickstart
$ source .venv/quickstart/bin/activate
- Install required packages:
$ pip install -r requirements.txt
- If your version of Python3 is 3.6 or less, install one more package:
$ pip install dataclasses
- Export environment variables:
For Azure
$ export $(grep -v '^#' config-azure.env | xargs -d '\n')
For AWS
$ export $(grep -v '^#' config-aws.env | xargs -d '\n')
- Run the server in quickstart/src folder:
$ cd src
$ gunicorn entry_api:api -b 0.0.0.0:8080
- Go to http://localhost:8080
- Edit docker-compose.yml to include configuration to your environment:
version : '3'
services:
backend:
env_file:
- config-<your-env>.env
build: .
ports:
- "8080:8080"
command: gunicorn entry_api:api -b 0.0.0.0:8080
- Build the image and run the container:
$ docker-compose up --build
- Go to http://localhost:8080