Skip to main content

External Systems

PyPI - Python Version PyPI License Autorelease

About Foundry Sources

The External Systems library is Python SDK built as an interface to reference Foundry Sources from code.

Installation

You can install the Python package using pip:

pip install external-systems

Basic Source Usage

HTTP Client

For REST based sources, a preconfigured HTTP client is provided built on top of the Python requests library. For on-prem systems using Agent Proxy the client will be pre-configured with the corresponding proxy

from external_systems.sources import Source, HttpsConnection
from requests import Session

my_source: Source = ...

https_connection: HttpsConnection = my_source.get_https_connection()

source_url: str = https_connection.url
http_client: Session = https_connection.get_client()

response = http_client.get(source_url + "/api/v1/example/", timeout=10)

Secrets

Source secrets can be referenced using get_secret("<secret_name>") on the source.

from external_systems.sources import Source

my_source: Source = ...

some_secret: str = my_source.get_secret("SECRET_NAME")

For sources using session credentials we support credentials generation and refresh management. This can be done by using get_session_credentials which supports S3 and BigQuery sources.

Session credentials may not be available in all Foundry runtime environments

from external_systems.sources import Source, Refreshable, SourceCredentials, AwsCredentials

s3_source: Source = ...

refreshable_credentials: Refreshable[SourceCredentials] = s3_source.get_session_credentials()

session_credentials: SourceCredentials = refreshable_credentials.get()

if not isinstance(session_credentials, AwsCredentials):
    raise ...

OIDC identity tokens

Sources configured with OIDC expose an identity token independently of their session credentials:

from external_systems.sources import IdToken, Source

my_source: Source = ...
oidc_token: IdToken = my_source.get_oidc_id_token()
# Supply oidc_token.token to your identity provider's token exchange client.
# oidc_token.expiration is a timezone-aware datetime.

Call get_oidc_id_token() whenever you need a valid token; it refreshes the cached token near expiration. Treat the JWT as a secret. Provider-specific token exchange is handled by the caller.

See the OIDC authentication documentation for the authentication flow and source-specific setup instructions.

On-prem Connectivity with Foundry Agent Proxy

Socket

For non-HTTP connections to external systems that require connections through Foundry's agent proxy, a pre-configured socket is provided.

On-Prem SFTP Server Example

For this example we'll be using the fabric library

import fabric

from external_systems.sources import Source
from socket import socket

SFTP_HOST = <sftp_host>
SFTP_PORT = <sftp_port>

on_prem_proxied_source: Source = ...

username: str = on_prem_sftp_server.get_secret("username")
password: str = on_prem_sftp_server.get_secret("password")

proxy_socket: socket = source.create_socket(SFTP_HOST, SFTP_PORT)

with fabric.Connection(
    SFTP_HOST,
    user=username,
    port=SFTP_PORT,
    connect_kwargs={
        "password": password,
        "sock": proxy_socket,
    },
) as conn:
    sftp = conn.sftp()
    file_list = sftp.listdir(".")

Authenticated Proxy URI

For more granular use cases a pre-authenticated proxy URI is provided to allow connections to on-prem external systems.

Example

We'll be using the httpx library.

import httpx

from external_systems.sources import Source

on_prem_system: Source = ...

authenticated_proxy_uri: str = on_prem_system.get_https_proxy_uri()

with httpx.Client(proxy=authenticated_proxy_uri) as client:
    ...

Metadata

Release files for external-systems 0.113.1

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

Source distribution (sdist)

Source distribution for external-systems 0.113.1
File Size Uploaded Provenance Actions
external_systems-0.113.1.tar.gz 13.5 kB Without provenance Details for external_systems-0.113.1.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for external-systems 0.113.1
File Interpreter ABI Platform Actions
external_systems-0.113.1-py3-none-any.whl Python 3 none any Details for external_systems-0.113.1-py3-none-any.whl

Total release size: 33.3 kB

Release files / external_systems-0.113.1.tar.gz

Download URL external_systems-0.113.1.tar.gz
Size 13.5 kB
Tags Source
SHA-256 checksum
How to use checksums
49384b6de6f378d74f39dcd43d1b58326a60fccb7d7e0eacf53682db7e3238d5
BLAKE2b-256 checksum
How to use checksums
ecb771e556a87c947e274c719182cb3a6585b4e0d7464fc530ab847095998ad7
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/2.5.1 CPython/3.12.16 Linux/7.0.0-1017-aws

Release files / external_systems-0.113.1-py3-none-any.whl

Download URL external_systems-0.113.1-py3-none-any.whl
Size 19.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
d9b31cd55b33056f53f09e6c30f838a6339a2d1812604a6698760dd33351b660
BLAKE2b-256 checksum
How to use checksums
bfd8ba5dc5b8dce59ed4e50d713a87392ce38b2b2a8123475a29097e4540ceb5
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/2.5.1 CPython/3.12.16 Linux/7.0.0-1017-aws

Security for external-systems 0.113.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.

Release history Release notifications | RSS feed

This release

0.113.1 This release

2 release files No provenance

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