Skip to main content

aiocloudlibrary

Asynchronous library to communicate with the Cloud Library API

maintainer buyme_coffee discord

MIT License

GitHub issues Average time to resolve an issue Percentage of issues still open PRs Welcome

Python

github release github release date github last-commit github contributors github commit activity

Cloud Library API Example Script

This example script demonstrates how to utilize the CloudLibraryClient class from the aiocloudlibrary module to interact with the Cloud Library API. It showcases various functionalities available within the client class to retrieve different types of data from the API.

Usage

  1. Installation: Ensure the aiocloudlibrary module is installed. If not, install it using pip install aiocloudlibrary.

  2. Configuration: Replace the placeholder details (barcode/email, PIN/password, library ID) within the script with actual values.

  3. Functionality Displayed:

    • current(): Fetches the current patron items.
    • history(): Retrieves the patron's borrowing history.
    • holds(): Retrieves the patron's holds.
    • saved(): Retrieves the patron's saved items.
    • featured(): Retrieves the patron's featured items.
    • email(): Retrieves the patron's email settings.
    • notifications(): Retrieves patron notifications (unread or archived).
  4. Execution: Run the script, and it will sequentially call these functions, displaying the retrieved data for each function.

Important Notes

  • Replace placeholder values (barcode, PIN, library ID) with your actual Cloud Library account details.
  • The notifications() function demonstrates both fetching unread notifications and archiving specific notifications.
  • Make sure you have appropriate access rights and permissions for the Cloud Library API endpoints being accessed.

Feel free to modify the script as needed, adding error handling, logging, or additional functionalities based on your requirements and the Cloud Library API's capabilities.

"""
Example Script: Accessing Cloud Library API with aiocloudlibrary

This script demonstrates fetching current patron items, borrowing history, holds, and saved items
from the Cloud Library API using the aiocloudlibrary library.

Make sure to replace 'xxxxxx@mail.com', 'xxxxxxxx', and 'xxxxx' with actual credentials and library details.

Requirements:
- aiocloudlibrary library (installed via pip)

Usage:
Run the script and observe the output displaying various data from the Cloud Library API.
"""

from aiocloudlibrary import CloudLibraryClient
import asyncio
import json

async def main():
    client = CloudLibraryClient(
        barcode="xxxxxx@mail.com",  # Replace with actual barcode/email
        pin="xxxxxxxx",  # Replace with actual PIN/password
        library="xxxxx"  # Replace with actual library ID
    )

    try:
        current = await client.current()
        print(f"Current Patron Items: {json.dumps(current, indent=2)}")

        history = await client.history()
        print(f"Patron's Borrowing History: {json.dumps(history, indent=2)}")

        holds = await client.holds()
        print(f"Patron's Holds: {json.dumps(holds, indent=2)}")

        saved_items = await client.saved()
        print(f"Patron's Saved Items: {json.dumps(saved_items, indent=2)}")

        featured_items = await client.featured()
        print(f"Patron's Featured Items: {json.dumps(featured_items, indent=2)}")

        email_settings = await client.email()
        print(f"Patron's Email Settings: {json.dumps(email_settings, indent=2)}")

        unread_notifications = await client.notifications()
        print(f"Unread Notifications: {json.dumps(unread_notifications, indent=2)}")

        notification_ids = ["notification_id_1", "notification_id_2"]  # Replace with actual notification IDs
        archived_notifications = await client.notifications(
            unread="false", notification_id_to_archive=notification_ids
        )
        print(f"Archived Notifications: {json.dumps(archived_notifications, indent=2)}")

    finally:
        await client.close_session()

asyncio.run(main())

Metadata

Release files for aiocloudlibrary 0.2.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for aiocloudlibrary 0.2.0
File Size Uploaded Provenance Actions
aiocloudlibrary-0.2.0.tar.gz 6.5 kB Without provenance Details for aiocloudlibrary-0.2.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for aiocloudlibrary 0.2.0
File Interpreter ABI Platform Actions
aiocloudlibrary-0.2.0-py3-none-any.whl Python 3 none any Details for aiocloudlibrary-0.2.0-py3-none-any.whl

Total release size: 13.1 kB

Release files / aiocloudlibrary-0.2.0.tar.gz

Download URL aiocloudlibrary-0.2.0.tar.gz
Size 6.5 kB
Tags Source
SHA-256 checksum
How to use checksums
17bf16b1c8b6d01e7295d8b2b2346da36cf1f506211da251dd82d14a88071aca
BLAKE2b-256 checksum
How to use checksums
d18bccc01a1122dc647b68ba6cc0a3dfcbc158417b6c549bd662fa174a7bc89e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.1.1 CPython/3.10.14

Release files / aiocloudlibrary-0.2.0-py3-none-any.whl

Download URL aiocloudlibrary-0.2.0-py3-none-any.whl
Size 6.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
f97d911baeb93765d9068d9ba5194b6016fdfdd620d9d1ca2a3234bee44b4a81
BLAKE2b-256 checksum
How to use checksums
74a4134f0fde637194b5b31f2bb48593f48ba0c8742b7d7feac4fb7172c70712
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.1.1 CPython/3.10.14

Security for aiocloudlibrary 0.2.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.2.0 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page