Skip to main content

FOLIO Auto Renew

An early preview of the Umbrellaleaf automatic renewals

folio-auto-renew provides a small set of async utilities to:

  1. Query FOLIO for loans that meet renewal criteria.
  2. Optionally filter loans by patron barcode patterns (optional).
  3. Submit renewal requests through the FOLIO circulation API.

This package is intended for libraries that want to automate recurring loan renewals using institution-specific policies.

Installation

python -m pip install folio-auto-renew

This library requires python 3.10+

Usage

from datetime import datetime, timezone

from folioclient import FolioClient
from folio_auto_renew import stream_loans, renew_loans

client = FolioClient(...)

renewable_loans = stream_loans(
    client=client,
    patron_barcode_patterns=None,
    due_date=datetime.now(timezone.utc),
)

await renew_loans(client, renewable_loans)

Patron Barcode Filtering

Loans can be filtered to only patrons who have barcodes starting with certain prefixes. For example:

renewable_loans = stream_loans(
    client=client,
    patron_barcode_patterns=[
        "2112",
        "3335",
    ],
    due_date=cutoff_date,
)

Passing None disables barcode filtering and processes all matching loans.

Customizing the base CQL query

The default query to identify loans is intended to be used by Five Colleges. Most libraries will need to replace this query before using the package.

The template is exposed as RENEWABLES_QUERY_TEMPLATE and can be replaced like this:

import folio_auto_renew

folio_auto_renew.RENEWABLES_QUERY_TEMPLATE = (
    'status="Open" '
    'AND itemStatus=="Checked Out" '
    'AND loanPolicyId=="<your-loan-policy-id>" '
    'AND dueDate<="{:%Y-%m-%dT%H:00:00%z}" '
    'sortBy id/sort.ascending'
)

It is important to preserve the due-date format placeholder so the cutoff date can be injected correctly.

Download files

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

Source Distribution

folio_auto_renew-0.0.1.tar.gz (10.0 kB view details)

Uploaded Source

Built Distribution

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

folio_auto_renew-0.0.1-py3-none-any.whl (9.1 kB view details)

Uploaded Python 3

File details

Details for the file folio_auto_renew-0.0.1.tar.gz.

File metadata

  • Download URL: folio_auto_renew-0.0.1.tar.gz
  • Upload date:
  • Size: 10.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for folio_auto_renew-0.0.1.tar.gz
Algorithm Hash digest
SHA256 9d39d694980b6294b72ed3c47cfbf363bdcfa6230bb0e2c0930653c71f1189dd
MD5 cd8dbbb319f652587a44c4c1efc7209c
BLAKE2b-256 7a7ccacfe0c8b1fbd4ebb89182f6cd52a3038a027096a0f8aa6a08834f4a17e7

See more details on using hashes here.

Provenance

The following attestation bundles were made for folio_auto_renew-0.0.1.tar.gz:

Publisher: publish.yml on Five-Colleges-Incorporated/folio-auto-renew

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

File details

Details for the file folio_auto_renew-0.0.1-py3-none-any.whl.

File metadata

File hashes

Hashes for folio_auto_renew-0.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 59af3b78dde8cfa928c3c141789b6b205386a4b1d343035b5d6f1a4a6b1adddc
MD5 a9b0fd4b8471ef9358b8bb19e65430a8
BLAKE2b-256 d8959973fdedbc45a9ed4f4dd33095d1dd5e9da7d5a0f19caef5953bf7931411

See more details on using hashes here.

Provenance

The following attestation bundles were made for folio_auto_renew-0.0.1-py3-none-any.whl:

Publisher: publish.yml on Five-Colleges-Incorporated/folio-auto-renew

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 Sentry Error logging StatusPage Status page