py-etp-client
An etp client python module to make an etp websocket connexion
installation :
Pip:
pip install py-etp-client
Poetry
poetry add py-etp-client
Usage :
Check example for more information
Interactive client (in example folder):
You can for example run a interactive client with the following code :
Install :
poetry install
Run the client :
poetry run client
Configuration and authentication
You can configure the client with a configuration file (yaml or json) or directly in code. You can also use different authentication methods :
- Basic authentication (username and password)
- OAuth2 (client ID and secret)
- Azure AD (client ID and secret)
- AWS Cognito (user pool ID and app client ID)
- GCP OAuth (service account key)
- Bearer token (pre-fetched token)
It is also possible to create configurations using environment variables.
Server Configuration
These environment variables configure the ETP server connection and behavior:
| Environment Variable | Description |
|---|---|
SERVER__ID |
Unique identifier for the server configuration |
SERVER_NAME |
Human-readable name for the server configuration |
SERVER_URL |
ETP server URL (including protocol and port) |
SERVER_URL_REST |
ETP server REST API URL (including protocol and port) |
SERVER_TIMEOUT |
Connection timeout in seconds |
SERVER_MAX_WEB_SOCKET_FRAME_PAYLOAD_SIZE |
Maximum WebSocket frame payload size in bytes |
SERVER_MAX_WEB_SOCKET_MESSAGE_PAYLOAD_SIZE |
Maximum WebSocket message payload size in bytes |
SERVER_VERIFY_SSL |
Whether to verify SSL certificates |
SERVER_AUTO_RECONNECT |
Whether to automatically reconnect on connection loss |
SERVER_USE_TRANSACTIONS |
Whether to use ETP transactions |
SERVER_SUPPORTED_DATA_OBJECTS |
List of supported ETP data object types |
SERVER_SUPPORTED_PROTOCOLS |
List of supported ETP protocol versions |
SERVER_ADDITIONAL_HEADERS |
Additional HTTP headers to include in requests |
SERVER_ACL_OWNERS |
OSDU ACL owners list |
SERVER_ACL_VIEWERS |
OSDU ACL viewers list |
SERVER_LEGAL_TAGS |
OSDU legal tags list |
SERVER_DATA_COUNTRIES |
OSDU data countries list |
SERVER_AUTH_METHOD |
Authentication method to use (e.g., basic, oauth2, azure, aws, gcp, bearer) |
Basic Authentication
Configure HTTP Basic Authentication credentials:
| Environment Variable | Description |
|---|---|
BASIC_USERNAME |
Username for basic authentication |
BASIC_PASSWORD |
Password for basic authentication |
OAuth2 Authentication
Configure OAuth2 client credentials flow:
| Environment Variable | Description |
|---|---|
OAUTH2_CLIENT_ID |
OAuth2 client ID |
OAUTH2_CLIENT_SECRET |
OAuth2 client secret |
OAUTH2_REFRESH_TOKEN |
OAuth2 refresh token (optional) |
OAUTH2_TOKEN_URL |
OAuth2 token endpoint URL |
OAUTH2_SCOPE |
OAuth2 scopes (space-separated) |
Azure Active Directory Authentication
Configure Azure AD authentication:
| Environment Variable | Description |
|---|---|
AZUREAD_TENANT_ID |
Azure AD tenant ID |
AZUREAD_CLIENT_ID |
Azure AD application (client) ID |
AZUREAD_CLIENT_SECRET |
Azure AD client secret |
AZUREAD_SCOPE |
Azure AD scopes (space-separated) |
AWS Cognito Authentication
Configure AWS Cognito authentication:
| Environment Variable | Description |
|---|---|
AWSCOGNITO_USER_POOL_ID |
AWS Cognito user pool ID |
AWSCOGNITO_APP_CLIENT_ID |
AWS Cognito app client ID |
AWSCOGNITO_CLIENT_SECRET |
AWS Cognito app client secret |
AWSCOGNITO_AWS_REGION |
AWS region for Cognito |
AWSCOGNITO_USERNAME |
Cognito username |
AWSCOGNITO_PASSWORD |
Cognito password |
AWSCOGNITO_REFRESH_TOKEN |
Cognito refresh token (optional) |
Google Cloud Platform Authentication
Configure GCP OAuth2 authentication:
| Environment Variable | Description |
|---|---|
GCPO_GCP_PROJECT_ID |
GCP project ID |
GCPO_SERVICE_ACCOUNT_KEY |
GCP service account key (JSON string or file path) |
GCPO_SCOPE |
GCP OAuth2 scopes (space-separated) |
Bearer Token Authentication
Configure static bearer token authentication:
| Environment Variable | Description |
|---|---|
BEARERTOKEN_CACHED_TOKEN |
Cached authentication token |
BEARERTOKEN_TOKEN_EXPIRES_AT |
Token expiration time (epoch time) |
Usage
Setting Environment Variables
You can set these environment variables in several ways:
-
System environment variables:
export SERVER_URL=wss://example.com/etp export SERVER_TIMEOUT=60
-
.envfile (recommended for development):SERVER_URL=wss://example.com/etp SERVER_TIMEOUT=60 AZUREAD_TENANT_ID=your-tenant-id AZUREAD_CLIENT_ID=your-client-id -
Programmatically:
import os os.environ['SERVER_URL'] = 'wss://example.com/etp'
Loading from Environment
from py_etp_client.etpconfig import ServerConfig
# Load configuration from environment variables
config = ServerConfig.from_env()
Complex Data Types
For list and dictionary fields, you can provide JSON strings:
export SERVER_SUPPORTED_DATA_OBJECTS='["resqml20.obj_Well", "resqml20.obj_WellboreGeometry"]'
export SERVER_ADDITIONAL_HEADERS='{"data-partition-id": "opendes", "Authorization": "Bearer token"}'
Metadata
Release files for py-etp-client 1.1.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| py_etp_client-1.1.1.tar.gz | 59.1 kB | Without provenance | Details for py_etp_client-1.1.1.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| py_etp_client-1.1.1-py3-none-any.whl | Python 3 | none | any | Details for py_etp_client-1.1.1-py3-none-any.whl |
Total release size: 122.3 kB
Release files / py_etp_client-1.1.1.tar.gz
| Download URL | py_etp_client-1.1.1.tar.gz |
|---|---|
| Size | 59.1 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
7e325c901dfffb6a0e85623e18887d802490a28b51f06fd38e7300c549bfd7d4
|
|
BLAKE2b-256 checksum How to use checksums |
a863a6180a0c02b26f6bf5179c91749e4ac749840a74ba963cfcb3d7e3f0620b
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/2.1.1 CPython/3.12.3 Linux/6.11.0-1018-azure
|
Release files / py_etp_client-1.1.1-py3-none-any.whl
| Download URL | py_etp_client-1.1.1-py3-none-any.whl |
|---|---|
| Size | 63.2 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
bf5a9e518621300d2183f157f22d6bc9f408276a509df599e0d27bd0493e9507
|
|
BLAKE2b-256 checksum How to use checksums |
0f8de2868bd47c2c72306608d1f0f9474b0786700db09e9e522c124bba36356f
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/2.1.1 CPython/3.12.3 Linux/6.11.0-1018-azure
|
Security for py-etp-client 1.1.1
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.