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.2.0.tar.gz (32.5 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.2.0-py3-none-any.whl (31.7 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: pbn_client-0.2.0.tar.gz
  • Upload date:
  • Size: 32.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: uv/0.11.28 {"installer":{"name":"uv","version":"0.11.28","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for pbn_client-0.2.0.tar.gz
Algorithm Hash digest
SHA256 d3b9f500c6c35a23d15a615d883bf4f82b4e58373c3d5b78322b90599e208954
MD5 7d4a33f68ac96ef37c96224735ffe3d6
BLAKE2b-256 aeb7c7af4c1124b14285d5d086e6df35379583cb67029bf61c98815c48feab2b

See more details on using hashes here.

File details

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

File metadata

  • Download URL: pbn_client-0.2.0-py3-none-any.whl
  • Upload date:
  • Size: 31.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: uv/0.11.28 {"installer":{"name":"uv","version":"0.11.28","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for pbn_client-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 df4b87acb7589e894029d039a8bfbb35bf0097861c36ba55197279ecb8e45fef
MD5 1f9980ca72aabb28e1ce109d761c7b07
BLAKE2b-256 245f8ab1c036011f966b424dba62b6c2cf70be89853a702c128e76fac3db61df

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