superfaktura.utils package
Submodules
superfaktura.utils.country module
Country Module.
This module provides utilities for working with countries in the SuperFaktura API.
- Functions:
- country_list: Retrieves a list of countries. 
 
- Usage:
- from superfaktura.utils.country import country_list countries = country_list() print(countries) 
- superfaktura.utils.country.country_list()
- Retrieves a list of countries. - This function returns a list of countries that can be used in the SuperFaktura API. - Returns:
- A list of countries. 
- Return type:
- list 
 
 - Usage:
- countries = country_list() print(countries) 
 
superfaktura.utils.data_types module
Data Types Module.
This module provides data types and utilities for working with dates and other data types in the SuperFaktura API.
- Classes:
- Date: Represents a date in the format YYYY-MM-DD. 
- DateTime: Represents a date and time in the format YYYY-MM-DD HH:MM:SS. 
 
- Functions:
- (none) 
 
- Usage:
- from superfaktura.utils.data_types import Date, DateTime date = Date(“2022-01-01”) datetime = DateTime(“2022-01-01 12:00:00”) 
- class superfaktura.utils.data_types.Date(date_str: str | None = None)
- Bases: - object- Date Class. - This class represents a date in the format YYYY-MM-DD. - - date
- The date in the format YYYY-MM-DD. - Type:
- str 
 
 - - __str__
- Returns the date as a string. 
 - Usage:
- date = Date(“2022-01-01”) print(date) # Output: 2022-01-01 
 - is_set() bool
- Returns True if the date is set, otherwise False. 
 - to_dict() str | None
- Converts the Date object to a serializable format. :return: The date as a string in YYYY-MM-DD format, or None if not set. 
 - to_json() str | None
- Converts the Date object to a JSON serializable format. :return: The date as a string in YYYY-MM-DD format, or None if not set. 
 
- class superfaktura.utils.data_types.DateEncoder(*, skipkeys=False, ensure_ascii=True, check_circular=True, allow_nan=True, sort_keys=False, indent=None, separators=None, default=None)
- Bases: - JSONEncoder- Date Encoder Class. - This class is a custom JSON encoder that converts Date objects to strings. - - default
- Encodes a Date object as a string. 
 - Usage:
- encoder = DateEncoder() date = Date(“2022-01-01”) json_string = json.dumps(date, cls=encoder) 
 - default(o)
- Implement this method in a subclass such that it returns a serializable object for - o, or calls the base implementation (to raise a- TypeError).- For example, to support arbitrary iterators, you could implement default like this: - def default(self, o): try: iterable = iter(o) except TypeError: pass else: return list(iterable) # Let the base class default method raise the TypeError return JSONEncoder.default(self, o)