Skip to main content

A python client for the Direct to INN-Reach (D2IR) API

Project description

D2IR Client for Python

D2IRClient implements a basic API client for the Direct to INN-Reach (D2IR) API for INN-Reach resource sharing services.

Getting Started

Installation

pip intall d2irclient

or

uv pip install d2irclient

Environment Variables

We recommend setting your connection parameters via environment variable:

export D2IR_API_KEY='<api_key>'
export D2IR_API_SECRET='<api_secret>'
export D2IR_AUTH_URL='https://<d2ir_server_domain>/auth/v1/oauth2/token'
export D2IR_ROOT_URL='https://<d2ir_server_domain>/innreach/'
export D2IR_LOCAL_SERVER_CODE='<local_server_code>'
export D2IR_CENTRAL_SERVER_CODE='<central_server_code>'

Connecting to the D2IR service

from d2irclient.D2IRClient import D2IRClient
dc = D2IRClient(
    d2ir_auth_url=os.environ.get("D2IR_AUTH_URL"),
    d2ir_root_url=os.environ.get("D2IR_ROOT_URL"),
    d2ir_key=os.environ.get("D2IR_API_KEY"),
    d2ir_secret=os.environ.get("D2IR_ROOT_URL"),
    from_server_code=os.environ.get("D2IR_LOCAL_SERVER_CODE"),
    to_server_code=os.environ.get("D2IR_CENTRAL_SERVER_CODE")
)

Calling APIs

# Fetch the current list of contributed locations
location_config = dc.d2ir_get("v2/contribution/locations")

# Add a location
location_config["locationList"].append({"locationKey": "abcde", "description": "Alphabet Library"})

# Replace all locations with updated list
_ = dc.d2ir_post("v2/contribution/locations", json=location_config)

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

d2irclient-0.1.0.tar.gz (5.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

d2irclient-0.1.0-py3-none-any.whl (6.3 kB view details)

Uploaded Python 3

File details

Details for the file d2irclient-0.1.0.tar.gz.

File metadata

  • Download URL: d2irclient-0.1.0.tar.gz
  • Upload date:
  • Size: 5.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for d2irclient-0.1.0.tar.gz
Algorithm Hash digest
SHA256 93c36c837444e148539236eed770cc090f13c5820449af35b68ac3d5d72b44ab
MD5 40078b655959612fddb9061ea5efa207
BLAKE2b-256 d744ddedfa670885a3ada91e0af5ddd97c53a372649d4fd9980ff9c278a5c098

See more details on using hashes here.

Provenance

The following attestation bundles were made for d2irclient-0.1.0.tar.gz:

Publisher: python-publish.yml on FOLIO-FSE/d2irclient

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file d2irclient-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: d2irclient-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 6.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for d2irclient-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 890ff5d368badac00ed271f800b45c200c04692d9a6c980caf95e008fb5196b7
MD5 f327282c531b58dee37edbc832625759
BLAKE2b-256 739da6b9daa97ab9e7d37cf0834550aa0181f1a708c3d6fe1413d16828d99404

See more details on using hashes here.

Provenance

The following attestation bundles were made for d2irclient-0.1.0-py3-none-any.whl:

Publisher: python-publish.yml on FOLIO-FSE/d2irclient

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page