SDKs overview

Wolne Lektury offers an API to facilitate programmatic access to its catalog of public domain Polish literature, including ebooks and audiobooks. The API allows developers to search for titles, retrieve book details, and integrate the platform's extensive collection into various applications. While the primary interface is a RESTful API, developers can leverage both officially supported and community-contributed SDKs and libraries to simplify interaction with this API.

The SDKs and libraries abstract away direct HTTP requests and JSON parsing, providing developers with language-specific methods and objects to interact with the Wolne Lektury API more efficiently. This approach is common in API ecosystems to improve developer experience and accelerate integration timelines. For example, Google provides client libraries for various programming languages to interact with its cloud services, such as the Cloud Client Libraries for Google Cloud, which streamline API calls and authentication processes.

The Wolne Lektury API documentation, available in Polish, details the available endpoints and data structures necessary for development. The ecosystem around Wolne Lektury's API primarily caters to Python developers, reflecting common preferences in data processing and academic research applications.

Official SDKs by language

Wolne Lektury primarily supports developers through its RESTful API and offers an official Python client library. This library is designed to provide a direct and idiomatic way for Python developers to interact with the Wolne Lektury API, simplifying tasks such as searching for books, retrieving metadata, and accessing content links.

The official library aims to encapsulate the complexities of HTTP requests and API response parsing, allowing developers to focus on integrating the literary content into their applications. Details regarding API endpoints and data models are outlined in the Wolne Lektury developer documentation.

Language Package Name Installation Command Maturity
Python wolnelektury-api pip install wolnelektury-api Stable

Installation

The installation process for the official Python SDK typically involves using pip, the standard package installer for Python. Before installation, it is recommended to ensure you have a compatible Python version installed (Python 3.6+ is generally supported) and that your pip tool is up to date.

To install the wolnelektury-api package, open your terminal or command prompt and execute the following command:

pip install wolnelektury-api

This command will download and install the package and its dependencies from the Python Package Index (PyPI). If you are working within a virtual environment, activate it before running the installation command to ensure the package is installed locally to your project, preventing potential conflicts with global Python installations. Virtual environments are a common practice in Python development to manage project-specific dependencies.

After installation, you can verify the package is installed correctly by attempting to import it in a Python interpreter or script:

import wolnelektury_api
print(wolnelektury_api.__version__) # Or attempt a basic API call

Successful execution without errors indicates that the library is ready for use in your project.

Quickstart example

The following Python example demonstrates how to use the wolnelektury-api library to search for books by a specific author and retrieve details for a chosen title. This quickstart illustrates fundamental API interaction patterns, including instantiating the client, performing a search, and accessing structured data from the responses.

import wolnelektury_api

# Initialize the API client
client = wolnelektury_api.Client()

# Search for books by a specific author (e.g., "Adam Mickiewicz")
search_query = "Adam Mickiewicz"
print(f"Searching for books by: {search_query}")

try:
    # The search method returns a list of book objects
    books = client.search_books(title=search_query)

    if books:
        print(f"Found {len(books)} books by {search_query}:")
        for i, book in enumerate(books[:5]): # Print details for the first 5 books
            print(f"  {i+1}. Title: {book.title}, Author: {book.author}, URL: {book.url}")
            
        # Get detailed information for a specific book, e.g., the first one found
        first_book_slug = books[0].slug
        print(f"\nRetrieving detailed information for '{books[0].title}' (slug: {first_book_slug})")
        detailed_book = client.get_book_by_slug(first_book_slug)

        if detailed_book:
            print(f"  Full Title: {detailed_book.title}")
            print(f"  Genre: {detailed_book.genre}")
            print(f"  Epoch: {detailed_book.epoch}")
            print(f"  Audiobook URL: {detailed_book.audiobook_url if detailed_book.audiobook_url else 'N/A'}")
            print(f"  Download PDF: {detailed_book.text_pdf_url if detailed_book.text_pdf_url else 'N/A'}")
        else:
            print(f"  Could not retrieve detailed information for slug: {first_book_slug}")
    else:
        print(f"No books found by {search_query}.")

except wolnelektury_api.exceptions.APIError as e:
    print(f"An API error occurred: {e}")
except Exception as e:
    print(f"An unexpected error occurred: {e}")

This snippet initializes the client, performs a search, and then iterates through the results to display basic information. It then fetches detailed information for the first book found, demonstrating how to access various attributes like genre, epoch, and direct download links. Error handling is included to catch potential API-specific issues or general exceptions during the process.

Community libraries

While Wolne Lektury provides an official Python SDK, the open nature of its API encourages community contributions. Developers may create and maintain libraries in other programming languages or specialized tools that extend the functionality of the official SDK or cater to specific use cases not covered by the primary offering.

Community libraries often emerge to fill gaps in language support, offer alternative abstractions, or integrate Wolne Lektury data with other platforms. These contributions are typically shared on platforms like GitHub or package managers specific to their languages (e.g., npm for JavaScript, Maven Central for Java). Before using a community-contributed library, developers are advised to assess its maintenance status, documentation quality, and community support. The Wolne Lektury developer page may list notable community projects, or developers can search public code repositories.

There are no widely adopted, officially recognized community libraries beyond the Python SDK at this time, but the API remains accessible for direct integration using any HTTP client library (e.g., requests in Python, fetch in JavaScript, or AWS SDK for Java for Java applications). This flexibility allows developers to build custom integrations regardless of official SDK availability for their preferred language.