# superfaktura.superfaktura_api module

SuperFaktura API Client.

This module provides classes and functions for working with the SuperFaktura API. It allows for reading, creating, updating, and deleting data in SuperFaktura.

Classes:

  - SuperFakturaAPI: The base class for working with the SuperFaktura API.

  - SuperFakturaAPIException: An exception for errors when working with the SuperFaktura API.

  - SuperFakturaAPIMissingCredentialsException: An exception for missing login credentials.

Functions:

  - get: Retrieves data from the SuperFaktura API.

  - post: Creates or updates data in the SuperFaktura API.

Usage:

  import superfaktura.superfaktura_api

  # Create an instance of SuperFakturaAPI api = superfaktura.superfaktura_api.SuperFakturaAPI()

  # Retrieve data from the SuperFaktura API data = api.get(‘endpoint’)

  # Create or update data in the SuperFaktura API api.post(‘endpoint’, data)

class superfaktura.superfaktura_api.SuperFakturaAPI

  Bases: `object`

  Base class for working with the SuperFaktura API.

  get(endpoint: str, timeout: int = 5) → Dict

    Retrieves data from the SuperFaktura API.

    Retrieves data from the specified endpoint in the SuperFaktura API.

    Parameters:

      - endpoint (str) – The API endpoint to retrieve data from (e.g. ‘invoices’, ‘clients’, etc.).

      - timeout (int, optional) – The timeout for the API request in seconds. Defaults to 5.

    Returns:

      The retrieved data in JSON format.

    Return type:

      Dict

    Raises:

      SuperFakturaAPIException – If the API request fails or returns an error.

    Examples

        >>> api = SuperFakturaAPI()
        >>> data = api.get('invoices')
        >>> print(data)

    Notes

    The available endpoints can be found in the SuperFaktura API documentation.

  post(endpoint: str, data: str, timeout: int = 5) → Dict

    Creates or updates data in the SuperFaktura API.

    Creates or updates data in the specified endpoint in the SuperFaktura API.

    Parameters:

      - endpoint (str) – The API endpoint to create or update data in (e.g. ‘invoices’, ‘clients’, etc.).

      - data (str) – The data to be created or updated in JSON format.

      - timeout (int, optional) – The timeout for the API request in seconds. Defaults to 5.

    Returns:

      The created or updated data in JSON format.

    Return type:

      Dict

    Raises:

      SuperFakturaAPIException – If the API request fails or returns an error.

    Examples

        >>> api = SuperFakturaAPI()
        >>> data = '{"name": "Example Invoice", "amount": 100.0}'
        >>> response = api.post('invoices', data)
        >>> print(response)

    Notes

    The available endpoints can be found in the SuperFaktura API documentation. The data should be a valid JSON string.

exception superfaktura.superfaktura_api.SuperFakturaAPIException

  Bases: `Exception`

  Exception for errors when working with the SuperFaktura API.

exception superfaktura.superfaktura_api.SuperFakturaAPIMissingCredentialsException

  Bases: `Exception`

  Exception for missing login credentials.