api
DrebedengiAPI ¶
DrebedengiAPI(
api_key: str,
login: str,
password: str,
*,
strict: bool = True,
soap_url: str = DREBEDENGI_DEFAULT_SOAP_URL,
wsdl_timeout: float = DREBEDENGI_DEFAULT_TIMEOUTS[0],
operation_timeout: float = DREBEDENGI_DEFAULT_TIMEOUTS[
1
]
) -> None
Drebedengi API Wrapper class.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
api_key |
str
|
api_key (get from drebedengi via support) |
required |
login |
str
|
your login |
required |
password |
str
|
your password |
required |
strict |
bool
|
strict mode - API calls will fail if the returned data doesn't match the model. Defaults to True. |
True
|
soap_url |
str
|
Optional alternative SOAP URL. Defaults to DREBEDENGI_DEFAULT_SOAP_URL. |
DREBEDENGI_DEFAULT_SOAP_URL
|
wsdl_timeout |
float
|
WSDL download timeout. Defaults to 60s. |
DREBEDENGI_DEFAULT_TIMEOUTS[0]
|
operation_timeout |
float
|
Operation timeout. Defaults to 300s. |
DREBEDENGI_DEFAULT_TIMEOUTS[1]
|
get_accounts ¶
get_accounts(
*, id_list: List[int] | None = None
) -> List[Account]
Implements getPlaceList API
Original wsdl description
Retrievs place list (array of arrays): [id] => Internal place ID; [budget_family_id] => User family ID (for multiuser mode); [type] => Type of object, 4 - places; [name] => Place name given by user; [is_hidden] => is place hidden in user interface; [is_autohide] => debts will auto hide on null balance; [is_for_duty] => Internal place for duty logic, Auto created while user adds "Waste or income duty"; [sort] => User sort of place list; [purse_of_nuid] => Not empty if place is purse of user# The value is internal user ID; [icon_id] => Place icon ID from http://www(dot)drebedengi(dot)ru/img/plicon_idgif; If parameter [idList] is given, it will be treat as ID list of objects to retrieve# this is used for synchronization; There is may be empty response, if user access level is limited;
get_changes ¶
get_changes(*, revision: int) -> List[ChangeRecord]
Implements getChangeList API
Original wsdl description
Get all changes (array of arrays) from server relative to given revision: [revision] => the revision of the change, [action_id] => the action of the change '1' - add, '2' - update, '3' - delete'; [object_type_id] => type of the object changed '1' - any record (transction), '2' - income source, '3' - waste category, '4' - place, '5' - currency, '6' - budget_tags, '7' - budget_accum, '8' - budget_accum_order; [object_id] => ID of the object for subsequent calls getRecordList, getCategoryList etc; [date] => the date of the change; Parameter [revision] => int8 number, usually saved on the client from last successfull sync.
get_currencies ¶
get_currencies(
*, id_list: List[int] | None = None
) -> List[Currency]
Implements getCurrencyList API
Original wsdl description
Retrievs currency list (array of arrays) with codes and courses: [id] => Internal currency ID; [name] => Currency name, given by user; [course] => current course from sbrf(dot)ru; [code] => International currency code (for course autoupdating); [family_id] => User family ID (for multiuser mode); [is_default] => is default currency# There should be only one default currency; [is_autoupdate] => autoupdate course once per day, from sbrf(dot)ru; [is_hidden] => is currency hidden in user interface; If parameter [idList] is given, it will be treat as ID list of objects to retrieve# this is used for synchronization;
get_current_revision ¶
get_current_revision() -> int
Implements getCurrentRevision API
Original wsdl description
Get current server revision number.
get_expense_categories ¶
get_expense_categories(
*, id_list: List[int] | None = None
) -> List[ExpenseCategory]
Implements getCategoryList API
Original wsdl description
Retrievs waste category list (array of arrays): [id] => Internal category ID; [parent_id] => For tree structure; [budget_family_id] => User family ID (for multiuser mode); [type] => Type of object, 3 - waste category; [name] => Category name given by user; [is_hidden] => is category hidden in user interface; [sort] => User sort of category tree; If parameter [idList] is given, it will be treat as ID list of objects to retrieve# this is used for synchronization;
get_income_sources ¶
get_income_sources(
*, id_list: List[int] | None = None
) -> List[IncomeSource]
Implements getSourceList API
Original wsdl description
Retrievs income source list (array of arrays): [id] => Internal source ID; [parent_id] => For tree structure; [budget_family_id] => User family ID (for multiuser mode); [type] => Type of object, 2 - income source; [name] => Source name given by user; [is_hidden] => is income hidden in user interface; [sort] => User sort of source tree; If parameter [idList] is given, it will be treat as ID list of objects to retrieve# this is used for synchronization;
get_tags ¶
get_tags(*, id_list: List[int] | None = None) -> List[Tag]
Implements getTagList API
Original wsdl description
Retrievs tag list (array of arrays): [id] => Internal tag ID; [family_id] => User family ID (for multiuser mode); [name] => Tag name given by user; [is_hidden] => is tag hidden in user interface; [is_family] => is tag visible for all family user, or user only; [sort] => User sort of tag list; [parent_id] => For tree view; If parameter [idList] is given, it will be treat as ID list of objects to retrieve# this is used for synchronization;
get_transactions ¶
get_transactions(
*,
relative_date: datetime | None = None,
period_from: datetime | None = None,
period_to: datetime | None = None,
account_filter: ReportFilterType = ReportFilterType.NONE,
account_filter_ids: List[int] | None = None,
tag_filter: ReportFilterType = ReportFilterType.NONE,
tag_filter_ids: List[int] | None = None,
category_filter: ReportFilterType = ReportFilterType.NONE,
category_filter_ids: List[int] | None = None,
include_types: TransactionType = TransactionType.ANY,
convert_to_currency_id: int = 0,
aggregated: bool = False,
group_by: ReportGrouping = ReportGrouping.NONE,
report_period: ReportPeriod = ReportPeriod.LAST_20_RECORD,
id_list: List[int] | None = None
) -> List[Transaction]
Implements getRecordList API
Original wsdl description
Retrievs record list (array of arrays) or report table by parameters; [params] => array of following parameters: 'is_report' [true|false (no default)] - retrievs data for report only or full records (waste, incomes, moves, changes) for export; 'relative_date' [YYYY-MM-DD (NOW by default)] - all data will be retrieved relative to this value, according to 'r_period' value; 'period_to', 'period_from' [YYYY-MM-DD] - custom period, if 'r_period' = 0; 'is_show_duty' [true(default)|false] - whether or not include duty record; 'r_period' [custom period = 0, this month = 1, today = 7, last month = 2, this quart = 3, this year = 4, last year = 5, all time = 6, last 20 record = 8 (default)] - period for which data will be obtained; 'r_what' [income = 2, waste = 3 (default), move = 4, change = 5, all types = 6] - type of data you want to get; 'r_who' [0 (default) - all users, int8 = user ID] - The data of the user to obtain, in the case of multiplayer mode; 'r_how' [show record list by detail = 1 (default), group incomes by source = 2, group wastes by category = 3] - Values 2 and 3 are for 'report' mode only# How to group the result record list; 'r_middle' [No average = 0 (default), Average monthly = 2592000, Average weekly = 604800, Averaged over days = 86400] - How to average the data, if r_how = 2 or 3; 'r_currency' [Original currency = 0 (default), int8 = currency ID] - Convert or not in to given currency; 'r_is_place', 'r_is_tag', 'r_is_category' [Include all = 0 (default), Include only selected = 1, All except selected = 2] - Exclude or include 'r_place', 'r_tag' or 'r_category' respectively; 'r_place', 'r_tag', 'r_category' [Array] - Array of numeric values for place ID, tag ID or category ID respectively; If parameter [idList] is given, it will be treat as ID list of objects to retrieve# this is used for synchronization;
DrebedengiAPIError ¶
DrebedengiAPIError(
message: str,
status_code: int,
response_text: str,
fault_code: str | None = None,
) -> None