Toloka documentation

Balance

toloka.metrics.metrics.Balance | Source code

Balance(
    self,
    balance_name: Optional[str] = None,
    *,
    toloka_client: Optional[TolokaClient] = None,
    atoloka_client: Optional[AsyncTolokaClient] = None,
    timeout: timedelta = ...
)

Traking your Toloka balance.

Returns only one metric: don't spend and don't reserved money on your acount.

Parameters Description

Parameters Type Description
balance_name Optional[str]

Metric name. Default 'toloka_requester_balance'.

Examples:

How to collect this metrics:

def print_metric(metric_dict):
    print(metric_dict)

collector = MetricCollector([Balance(toloka_client=toloka_client)], print_metric)
asyncio.run(collector.run())
toloka_requester_balance: [(datetime.datetime(2021, 8, 30, 10, 30, 59, 628239), Decimal('123.4500'))],

}

Methods Summary

Method Description
get_line_names Returns a list of metric names that can be generated by this class instance.