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(
    auth_url=os.environ.get("D2IR_AUTH_URL"),
    root_url=os.environ.get("D2IR_ROOT_URL"),
    auth_key=os.environ.get("D2IR_API_KEY"),
    auth_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.1.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.1-py3-none-any.whl (6.3 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: d2irclient-0.1.1.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.1.tar.gz
Algorithm Hash digest
SHA256 f337af3c20b1089b496285130b58bd26337e85b9fd62e63b97bbb8248d06785b
MD5 c98f3f6e70083c79ff95b84a8c5c3c7e
BLAKE2b-256 2255c046356c062046baef19836a54763ee8f85abee94ebe04997e90caed12c4

See more details on using hashes here.

Provenance

The following attestation bundles were made for d2irclient-0.1.1.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.1-py3-none-any.whl.

File metadata

  • Download URL: d2irclient-0.1.1-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.1-py3-none-any.whl
Algorithm Hash digest
SHA256 136340d97456382b9e2233480a17220eefbab75950b2b67466bc6bede5f6d95e
MD5 7224f85902e4b59eca59b9310abf27c7
BLAKE2b-256 db16b69138101ddcb3f477e55ceeca75ea88d95d11fbe32ef0c546916bbfa288

See more details on using hashes here.

Provenance

The following attestation bundles were made for d2irclient-0.1.1-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