Skip to main content

eq-api-connector

A small python package to handle authentication and act as a generic api sdk.

It supports apis Public client applications using acquire_token_interactive and contains a few basic endpoint accessors.

Install

Install from pypi pip install eq-api-connector or clone and use uv sync as a developer.

Usage

See the dummy example below

from eq_api_connector import APIConnector

url_prod = "https://api.gateway.equinor.com/dummy/v1"
client_id = "insert_your_client_id_here"  # IOC SME monitoring SDK
scope = ["34de7368-10f7-4c34-a4df-928156065f2c/ReadWrite"]

c = APIConnector(client_id=client_id, scope=scope)
c.url_prod = url_prod

model_owners = c.get_json("/example-endpoint")

If you already have an access token, pass it with token:

access_token = get_access_token_from_your_auth_flow()
c = APIConnector(token=access_token)

When a token is supplied, APIConnector uses it as-is and does not check its expiry or refresh it. The caller is responsible for obtaining and supplying a fresh token when it expires.

Typically packages using eq-api-connector should subclass the APIConnector or keep a singleton a reference.

Optional API Subscription Key (APIM)

Some APIs require an API subscription key (called an APIM key in Equinor) in addition to MSAL sign-in. Pass it as subscription_key:

import os
from eq_api_connector import APIConnector

c = APIConnector(
	client_id=client_id,
	scope=scope,
	subscription_key=os.getenv("APIM_SUBSCRIPTION_KEY"),
)
c.url_prod = url_prod

When set, the key is sent as the Ocp-Apim-Subscription-Key header for all requests, including concurrent reads, downloads and uploads. Omitting it leaves the existing bearer-token authentication unchanged; MSAL authentication is still required. The connector does not automatically read environment variables or retrieve keys from Azure Key Vault.

Use c.subscription_key = new_key to replace the key, or c.subscription_key = None (or "") to remove it. Only use the connector with trusted API URLs and redirect destinations, since its session carries the key. Store keys outside source code, for example in an environment variable or a secret store. Do not commit keys or log request headers containing them.

Metadata

Release files for eq-api-connector 1.2.3

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for eq-api-connector 1.2.3
File Size Uploaded Provenance Actions
eq_api_connector-1.2.3.tar.gz 7.0 kB Without provenance Details for eq_api_connector-1.2.3.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for eq-api-connector 1.2.3
File Interpreter ABI Platform Actions
eq_api_connector-1.2.3-py3-none-any.whl Python 3 none any Details for eq_api_connector-1.2.3-py3-none-any.whl

Total release size: 18.4 kB

Release files / eq_api_connector-1.2.3.tar.gz

Download URL eq_api_connector-1.2.3.tar.gz
Size 7.0 kB
Tags Source
SHA-256 checksum
How to use checksums
6d8ea7dd4e5a9fff5028be76dd73e16d257f51fccb34d80b86ba0bbf2beeb3d5
BLAKE2b-256 checksum
How to use checksums
7918db9b661745a05005b0c742f46e5349de40f39b549ce40aa52b6dd04dc59c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/2.3.3 CPython/3.13.7 Darwin/27.2.0

Release files / eq_api_connector-1.2.3-py3-none-any.whl

Download URL eq_api_connector-1.2.3-py3-none-any.whl
Size 11.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
2b5cf4537564c5ada9265540142011629ab365fd5a9c454c566ecdaddc0f8b18
BLAKE2b-256 checksum
How to use checksums
1ae4dc9e4a1f95179b894c4e5da5bfc7d7a753d4e959b35816124240b8244018
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/2.3.3 CPython/3.13.7 Darwin/27.2.0

Security for eq-api-connector 1.2.3

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.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page