belvo.resources.balances

 1from datetime import date
 2from typing import Dict, List, Union
 3
 4from belvo.resources.base import Resource
 5
 6
 7class Balances(Resource):
 8    endpoint = "/api/balances/"
 9
10    def create(
11        self,
12        link: str,
13        date_from: str,
14        *,
15        date_to: str = None,
16        account: str = None,
17        token: str = None,
18        save_data: bool = True,
19        raise_exception: bool = False,
20        **kwargs: Dict,
21    ) -> Union[List[Dict], Dict]:
22        """Retrieve balances for a link
23
24        Retrieve balances from one or more accounts for a specific link within a specified date range. You must provide a Link and a date range defined by `date_from` and `date_to`.
25
26        Example:
27        ```python
28        # Fetch balances for a Link
29        balances = client.Balances.create(
30            "b91835f5-6f83-4d9b-a0ad-a5a249f18b7c",
31            "2019-07-01",
32            date_to="2019-07-31"
33        )
34
35        # Fetch balances for a Link with timeout after 15 seconds
36        balances = client.Balances.create(
37            "b91835f5-6f83-4d9b-a0ad-a5a249f18b7c",
38            "2019-07-01",
39            date_to="2019-07-31",
40            timeout=15
41        )
42        ```
43
44        Args:
45            link (str): The `link.id` that you want to get information for (UUID).
46            date_from (str): Date from which you want to start receiving balances, in `YYYY-MM-DD` format. The value of `date_from` cannot be greater than `date_to`.
47            date_to (str, optional): Date that you want to stop receiving balances, in `YYYY-MM-DD` format. The value of `date_to` cannot be greater than today's date (in other words, no future dates). If you do not provide a `date_to` we automatically set the date to today.
48            account (str, optional): If provided, only balances matching this `account.id` are returned (UUID). Defaults to None.
49            token (str, optional): The MFA token generated by the bank in order to access the institution. Defaults to None.
50            save_data (bool, optional): Indicates whether or not to persist the data in Belvo. Defaults to `True`.
51            raise_exception (bool, optional): Indicates whether to raise an exception or return the API error. Defaults to `False`.
52
53        Returns:
54            Union[List[Dict], Dict]: For more information on the response from the API, see our [Balances API documentation](https://developers.belvo.com/reference/retrievebalances).
55        """
56
57        date_to = date_to or date.today().isoformat()
58
59        data = {"link": link, "date_from": date_from, "date_to": date_to, "save_data": save_data}
60
61        if account:
62            data.update(account=account)
63        if token:
64            data.update(token=token)
65
66        return self.session.post(
67            self.endpoint, data=data, raise_exception=raise_exception, **kwargs
68        )
class Balances(belvo.resources.base.Resource):
 8class Balances(Resource):
 9    endpoint = "/api/balances/"
10
11    def create(
12        self,
13        link: str,
14        date_from: str,
15        *,
16        date_to: str = None,
17        account: str = None,
18        token: str = None,
19        save_data: bool = True,
20        raise_exception: bool = False,
21        **kwargs: Dict,
22    ) -> Union[List[Dict], Dict]:
23        """Retrieve balances for a link
24
25        Retrieve balances from one or more accounts for a specific link within a specified date range. You must provide a Link and a date range defined by `date_from` and `date_to`.
26
27        Example:
28        ```python
29        # Fetch balances for a Link
30        balances = client.Balances.create(
31            "b91835f5-6f83-4d9b-a0ad-a5a249f18b7c",
32            "2019-07-01",
33            date_to="2019-07-31"
34        )
35
36        # Fetch balances for a Link with timeout after 15 seconds
37        balances = client.Balances.create(
38            "b91835f5-6f83-4d9b-a0ad-a5a249f18b7c",
39            "2019-07-01",
40            date_to="2019-07-31",
41            timeout=15
42        )
43        ```
44
45        Args:
46            link (str): The `link.id` that you want to get information for (UUID).
47            date_from (str): Date from which you want to start receiving balances, in `YYYY-MM-DD` format. The value of `date_from` cannot be greater than `date_to`.
48            date_to (str, optional): Date that you want to stop receiving balances, in `YYYY-MM-DD` format. The value of `date_to` cannot be greater than today's date (in other words, no future dates). If you do not provide a `date_to` we automatically set the date to today.
49            account (str, optional): If provided, only balances matching this `account.id` are returned (UUID). Defaults to None.
50            token (str, optional): The MFA token generated by the bank in order to access the institution. Defaults to None.
51            save_data (bool, optional): Indicates whether or not to persist the data in Belvo. Defaults to `True`.
52            raise_exception (bool, optional): Indicates whether to raise an exception or return the API error. Defaults to `False`.
53
54        Returns:
55            Union[List[Dict], Dict]: For more information on the response from the API, see our [Balances API documentation](https://developers.belvo.com/reference/retrievebalances).
56        """
57
58        date_to = date_to or date.today().isoformat()
59
60        data = {"link": link, "date_from": date_from, "date_to": date_to, "save_data": save_data}
61
62        if account:
63            data.update(account=account)
64        if token:
65            data.update(token=token)
66
67        return self.session.post(
68            self.endpoint, data=data, raise_exception=raise_exception, **kwargs
69        )
endpoint = '/api/balances/'
def create( self, link: str, date_from: str, *, date_to: str = None, account: str = None, token: str = None, save_data: bool = True, raise_exception: bool = False, **kwargs: Dict) -> Union[List[Dict], Dict]:
11    def create(
12        self,
13        link: str,
14        date_from: str,
15        *,
16        date_to: str = None,
17        account: str = None,
18        token: str = None,
19        save_data: bool = True,
20        raise_exception: bool = False,
21        **kwargs: Dict,
22    ) -> Union[List[Dict], Dict]:
23        """Retrieve balances for a link
24
25        Retrieve balances from one or more accounts for a specific link within a specified date range. You must provide a Link and a date range defined by `date_from` and `date_to`.
26
27        Example:
28        ```python
29        # Fetch balances for a Link
30        balances = client.Balances.create(
31            "b91835f5-6f83-4d9b-a0ad-a5a249f18b7c",
32            "2019-07-01",
33            date_to="2019-07-31"
34        )
35
36        # Fetch balances for a Link with timeout after 15 seconds
37        balances = client.Balances.create(
38            "b91835f5-6f83-4d9b-a0ad-a5a249f18b7c",
39            "2019-07-01",
40            date_to="2019-07-31",
41            timeout=15
42        )
43        ```
44
45        Args:
46            link (str): The `link.id` that you want to get information for (UUID).
47            date_from (str): Date from which you want to start receiving balances, in `YYYY-MM-DD` format. The value of `date_from` cannot be greater than `date_to`.
48            date_to (str, optional): Date that you want to stop receiving balances, in `YYYY-MM-DD` format. The value of `date_to` cannot be greater than today's date (in other words, no future dates). If you do not provide a `date_to` we automatically set the date to today.
49            account (str, optional): If provided, only balances matching this `account.id` are returned (UUID). Defaults to None.
50            token (str, optional): The MFA token generated by the bank in order to access the institution. Defaults to None.
51            save_data (bool, optional): Indicates whether or not to persist the data in Belvo. Defaults to `True`.
52            raise_exception (bool, optional): Indicates whether to raise an exception or return the API error. Defaults to `False`.
53
54        Returns:
55            Union[List[Dict], Dict]: For more information on the response from the API, see our [Balances API documentation](https://developers.belvo.com/reference/retrievebalances).
56        """
57
58        date_to = date_to or date.today().isoformat()
59
60        data = {"link": link, "date_from": date_from, "date_to": date_to, "save_data": save_data}
61
62        if account:
63            data.update(account=account)
64        if token:
65            data.update(token=token)
66
67        return self.session.post(
68            self.endpoint, data=data, raise_exception=raise_exception, **kwargs
69        )

Retrieve balances for a link

Retrieve balances from one or more accounts for a specific link within a specified date range. You must provide a Link and a date range defined by date_from and date_to.

Example:

# Fetch balances for a Link
balances = client.Balances.create(
    "b91835f5-6f83-4d9b-a0ad-a5a249f18b7c",
    "2019-07-01",
    date_to="2019-07-31"
)

# Fetch balances for a Link with timeout after 15 seconds
balances = client.Balances.create(
    "b91835f5-6f83-4d9b-a0ad-a5a249f18b7c",
    "2019-07-01",
    date_to="2019-07-31",
    timeout=15
)
Arguments:
  • link (str): The link.id that you want to get information for (UUID).
  • date_from (str): Date from which you want to start receiving balances, in YYYY-MM-DD format. The value of date_from cannot be greater than date_to.
  • date_to (str, optional): Date that you want to stop receiving balances, in YYYY-MM-DD format. The value of date_to cannot be greater than today's date (in other words, no future dates). If you do not provide a date_to we automatically set the date to today.
  • account (str, optional): If provided, only balances matching this account.id are returned (UUID). Defaults to None.
  • token (str, optional): The MFA token generated by the bank in order to access the institution. Defaults to None.
  • save_data (bool, optional): Indicates whether or not to persist the data in Belvo. Defaults to True.
  • raise_exception (bool, optional): Indicates whether to raise an exception or return the API error. Defaults to False.
Returns:

Union[List[Dict], Dict]: For more information on the response from the API, see our Balances API documentation.