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.2.tar.gz (10.1 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.2-py3-none-any.whl (9.2 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: folio_auto_renew-0.0.2.tar.gz
  • Upload date:
  • Size: 10.1 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.2.tar.gz
Algorithm Hash digest
SHA256 d53e68ba76d367d1a2feecaec1d9906a3851d322fa04b9b2a70fa22db4614529
MD5 41b5c903f73a35a95aebd93ce20ff516
BLAKE2b-256 867091bd494ccf6bb5581c79ca2d2d26ea077ca6d3be03deddae37be7ae9fbb7

See more details on using hashes here.

Provenance

The following attestation bundles were made for folio_auto_renew-0.0.2.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.2-py3-none-any.whl.

File metadata

File hashes

Hashes for folio_auto_renew-0.0.2-py3-none-any.whl
Algorithm Hash digest
SHA256 31b5ad6727ab2f88a0a0215eb78a1d138dddccec1871464209bf933c6712b2a3
MD5 d1dc9a29fd64bf84e4d1882694e757af
BLAKE2b-256 cdad54846eb79262cfe6fa2403472579aa85d14b50985ea433f5991e864cd1cc

See more details on using hashes here.

Provenance

The following attestation bundles were made for folio_auto_renew-0.0.2-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