Skip to main content

Framework-independent client for the Polish Bibliography Network API

Project description

pbn-client

CI License: MIT

pbn-client is a framework-independent Python client for communication with the Polish Bibliography Network (PBN) API. It provides HTTP authentication, pagination, dictionary and publication endpoints, and institution-profile statement operations.

The package does not depend on Django or an external error-reporting service. Projects that persist downloaded PBN data in Django should use the companion django-pbn-client package.

Installation

pip install pbn-client

Python 3.10 through 3.14 is supported.

Basic usage

from pbn_client import PBNClient, RequestsTransport

transport = RequestsTransport(
    app_id="application-id",
    app_token="application-token",
    base_url="https://pbn-micro-alpha.opi.org.pl",
    user_token="user-token",
    timeout=(30, 120),
)
client = PBNClient(transport)

languages = list(client.get_languages())

Credentials should normally be supplied explicitly. The interactive command helpers also understand PBN_CLIENT_APP_ID, PBN_CLIENT_APP_TOKEN, PBN_CLIENT_BASE_URL, PBN_CLIENT_USER_TOKEN, and PBN_CLIENT_HTTP_TIMEOUT. A timeout may be a single number or a connect,read pair.

Error reporting

The standalone default reporter is a no-op. An application can inject any object implementing ErrorReporter when it constructs a transport:

import rollbar

from pbn_client import RequestsTransport

transport = RequestsTransport(
    "application-id",
    "application-token",
    "https://pbn-micro-alpha.opi.org.pl",
    reporter=rollbar,
)

The reporter receives only scrubbed diagnostic metadata. Response bodies and authentication header values are not sent to it. LoggingReporter, NullReporter, and set_default_reporter() are also available for applications that prefer a process-wide policy.

Development

From the repository root:

uv run --isolated pytest
uv run ruff check .
uv build

License

pbn-client is released under the MIT License.

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

pbn_client-0.1.0.tar.gz (24.1 kB view details)

Uploaded Source

Built Distribution

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

pbn_client-0.1.0-py3-none-any.whl (26.8 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: pbn_client-0.1.0.tar.gz
  • Upload date:
  • Size: 24.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.11.14 {"installer":{"name":"uv","version":"0.11.14","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for pbn_client-0.1.0.tar.gz
Algorithm Hash digest
SHA256 6a691e9f9be4ab6e63ccba6461099a4202355d79d0df26fe7f5108586f4fc46f
MD5 b5e5766e56a6095cc44cc499afc09370
BLAKE2b-256 14772aebe056db372f0a81b17466bc183e578c7e875f8fdd009268c19c1ec666

See more details on using hashes here.

File details

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

File metadata

  • Download URL: pbn_client-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 26.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.11.14 {"installer":{"name":"uv","version":"0.11.14","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for pbn_client-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 2b531bacc34d150d72d6d18d5c8d1b1c03a06d7d9bf9df3d3237f549255cc024
MD5 198df17930f611016aeade622c56f3d2
BLAKE2b-256 afaa0dedd9259aba97109e9bfb4a823d7ad3683379bf12001f959d2fe246f9ad

See more details on using hashes here.

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