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.
GET requests retry up to three times after connection or response-read failures, or transient HTTP statuses (429, 500, 502, 503, and 504), with exponential backoff. POSTs are not retried after transmission; connection-establishment attempts can retry before the request is sent.
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.4
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 |
|---|---|---|---|---|
| eq_api_connector-1.2.4.tar.gz | 7.4 kB | Without provenance | Details for eq_api_connector-1.2.4.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| eq_api_connector-1.2.4-py3-none-any.whl | Python 3 | none | any | Details for eq_api_connector-1.2.4-py3-none-any.whl |
Total release size: 19.2 kB
Release files / eq_api_connector-1.2.4.tar.gz
| Download URL | eq_api_connector-1.2.4.tar.gz |
|---|---|
| Size | 7.4 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
fd9786bae90ec654bf45af173d0c8330593558a80dd1118963037e03bb19b208
|
|
BLAKE2b-256 checksum How to use checksums |
7759ee62729c491dff0fff5c76c5fb4bc29a90174426eaabac1acc9fe00f6e4d
|
| 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.4-py3-none-any.whl
| Download URL | eq_api_connector-1.2.4-py3-none-any.whl |
|---|---|
| Size | 11.8 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
a54007fd8c06f7aee68e1abaf80bfb29af3605df63fa377e017a6ebf9a71b1e5
|
|
BLAKE2b-256 checksum How to use checksums |
1769007e5385c4acc50673cb4343a3413f9fc4af35e5abd7dfd51198c7ae8950
|
| 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.4
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.