tap-belvo 0.3.5__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,44 @@
1
+ """Stream classes for tap-belvo."""
2
+
3
+ from __future__ import annotations
4
+
5
+ from tap_belvo.streams.banking import (
6
+ Accounts,
7
+ Balances,
8
+ InvestmentPortfolios,
9
+ InvestmentTransactions,
10
+ Owners,
11
+ ReceivableTransactions,
12
+ Transactions,
13
+ )
14
+ from tap_belvo.streams.core import Institutions, Links
15
+ from tap_belvo.streams.enrichment import Incomes, RecurringExpenses, RiskInsights
16
+ from tap_belvo.streams.fiscal import (
17
+ Invoices,
18
+ TaxComplianceStatuses,
19
+ TaxDeclarations,
20
+ TaxRetentions,
21
+ TaxReturns,
22
+ TaxStatuses,
23
+ )
24
+
25
+ __all__ = [
26
+ "Accounts",
27
+ "Balances",
28
+ "Incomes",
29
+ "Institutions",
30
+ "InvestmentPortfolios",
31
+ "InvestmentTransactions",
32
+ "Invoices",
33
+ "Links",
34
+ "Owners",
35
+ "ReceivableTransactions",
36
+ "RecurringExpenses",
37
+ "RiskInsights",
38
+ "TaxComplianceStatuses",
39
+ "TaxDeclarations",
40
+ "TaxRetentions",
41
+ "TaxReturns",
42
+ "TaxStatuses",
43
+ "Transactions",
44
+ ]
@@ -0,0 +1,103 @@
1
+ """Stream type classes for tap-belvo."""
2
+
3
+ from __future__ import annotations
4
+
5
+ import sys
6
+ from typing import TYPE_CHECKING, Any
7
+
8
+ from tap_belvo.client import BelvoStream
9
+ from tap_belvo.streams.core import Links
10
+
11
+ if sys.version_info >= (3, 12):
12
+ from typing import override
13
+ else:
14
+ from typing_extensions import override
15
+
16
+ if TYPE_CHECKING:
17
+ from urllib.parse import ParseResult
18
+
19
+ from singer_sdk.helpers.types import Context
20
+
21
+
22
+ class Accounts(BelvoStream):
23
+ """Accounts stream."""
24
+
25
+ name = "banking_accounts"
26
+ path = "/api/accounts"
27
+ primary_keys = ("id",)
28
+ replication_key = "created_at"
29
+ openapi_ref = "Account"
30
+
31
+
32
+ class Transactions(BelvoStream):
33
+ """Transactions stream."""
34
+
35
+ name = "banking_transactions"
36
+ path = "/api/transactions"
37
+ primary_keys = ("id",)
38
+ replication_key = "created_at"
39
+ openapi_ref = "Account"
40
+ parent_stream_type = Links
41
+
42
+ @override
43
+ def get_url_params(
44
+ self,
45
+ context: Context | None,
46
+ next_page_token: ParseResult | None,
47
+ ) -> dict[str, Any]:
48
+ params = super().get_url_params(context, next_page_token)
49
+
50
+ if context is not None:
51
+ params["link"] = context["link_id"]
52
+
53
+ return params
54
+
55
+
56
+ class Balances(BelvoStream):
57
+ """DEPRECATED. Balances stream."""
58
+
59
+ name = "banking_balances"
60
+ path = "/api/balances"
61
+ primary_keys = ("id",)
62
+ replication_key = "value_date"
63
+ openapi_ref = "Balance"
64
+
65
+
66
+ class Owners(BelvoStream):
67
+ """Owners stream."""
68
+
69
+ name = "banking_owners"
70
+ path = "/api/owners"
71
+ primary_keys = ("id",)
72
+ replication_key = "created_at"
73
+ openapi_ref = "Owner"
74
+
75
+
76
+ class InvestmentPortfolios(BelvoStream):
77
+ """Portfolios stream."""
78
+
79
+ name = "investment_portfolios"
80
+ path = "/investments/portfolios"
81
+ primary_keys = ("id",)
82
+ replication_key = None
83
+ openapi_ref = "InvestmentsPortfolio"
84
+
85
+
86
+ class InvestmentTransactions(BelvoStream):
87
+ """Investment transactions stream."""
88
+
89
+ name = "investment_transactions"
90
+ path = "/investments/transactions"
91
+ primary_keys = ("id",)
92
+ replication_key = "created_at"
93
+ openapi_ref = "InvestmentsInstrumentTransaction"
94
+
95
+
96
+ class ReceivableTransactions(BelvoStream):
97
+ """Receivable transactions stream."""
98
+
99
+ name = "receivable_transactions"
100
+ path = "/receivables/transactions"
101
+ primary_keys = ("id",)
102
+ replication_key = "created_at"
103
+ openapi_ref = "ReceivablesTransaction"
@@ -0,0 +1,54 @@
1
+ """Stream type classes for tap-belvo."""
2
+
3
+ from __future__ import annotations
4
+
5
+ import sys
6
+ from typing import TYPE_CHECKING, Any
7
+
8
+ from tap_belvo.client import BelvoStream
9
+
10
+ if sys.version_info >= (3, 12):
11
+ from typing import override
12
+ else:
13
+ from typing_extensions import override
14
+
15
+ if TYPE_CHECKING:
16
+ from singer_sdk.helpers.types import Context
17
+
18
+
19
+ class Links(BelvoStream):
20
+ """Links stream."""
21
+
22
+ name = "links"
23
+ path = "/api/links"
24
+ primary_keys = ("id",)
25
+ replication_key = "created_at"
26
+ openapi_ref = "Link"
27
+
28
+ @override
29
+ def get_child_context(
30
+ self,
31
+ record: dict[str, Any],
32
+ context: Context | None,
33
+ ) -> dict[Any, Any]:
34
+ return {"link_id": record["id"]}
35
+
36
+
37
+ class Institutions(BelvoStream):
38
+ """Institutions stream."""
39
+
40
+ name = "institutions"
41
+ path = "/api/institutions"
42
+ primary_keys = ("id",)
43
+ replication_key = None
44
+ openapi_ref = "InstitutionPublicApi"
45
+
46
+
47
+ class Consents(BelvoStream):
48
+ """Consents stream."""
49
+
50
+ name = "consents"
51
+ path = "/api/consents"
52
+ primary_keys = ("id",)
53
+ replication_key = None
54
+ openapi_ref = "Consents"
@@ -0,0 +1,34 @@
1
+ """Stream type classes for tap-belvo."""
2
+
3
+ from __future__ import annotations
4
+
5
+ from tap_belvo.client import BelvoStream
6
+
7
+
8
+ class Incomes(BelvoStream):
9
+ """Incomes stream."""
10
+
11
+ name = "enrichment_incomes"
12
+ path = "/api/incomes"
13
+ primary_keys = ("id",)
14
+ openapi_ref = "Income"
15
+
16
+
17
+ class RecurringExpenses(BelvoStream):
18
+ """RecurringExpenses stream."""
19
+
20
+ name = "enrichment_recurring_expenses"
21
+ path = "/api/recurring-expenses"
22
+ primary_keys = ("id",)
23
+ replication_key = None
24
+ openapi_ref = "RecurringExpenses"
25
+
26
+
27
+ class RiskInsights(BelvoStream):
28
+ """RiskInsights stream."""
29
+
30
+ name = "enrichment_risk_insights"
31
+ path = "/api/risk-insights"
32
+ primary_keys = ("id",)
33
+ replication_key = None
34
+ openapi_ref = "RiskInsights"
@@ -0,0 +1,66 @@
1
+ """Fiscal stream type classes for tap-belvo."""
2
+
3
+ from __future__ import annotations
4
+
5
+ from tap_belvo.client import BelvoStream
6
+
7
+
8
+ class Invoices(BelvoStream):
9
+ """Invoices stream."""
10
+
11
+ name = "fiscal_invoices"
12
+ path = "/api/invoices"
13
+ primary_keys = ("id",)
14
+ replication_key = "created_at"
15
+ openapi_ref = "InvoiceWithIdSat"
16
+
17
+
18
+ class TaxComplianceStatuses(BelvoStream):
19
+ """Tax Compliance Statuses stream."""
20
+
21
+ name = "fiscal_tax_compliance_statuses"
22
+ path = "/api/tax-compliance-status"
23
+ primary_keys = ("id",)
24
+ replication_key = "created_at"
25
+ openapi_ref = "TaxComplianceStatus"
26
+
27
+
28
+ # NOTE: This is stream is in beta and its schema is not yet documented.
29
+ class TaxDeclarations(BelvoStream):
30
+ """Tax Declarations stream."""
31
+
32
+ name = "fiscal_tax_declarations"
33
+ path = "/api/tax-declarations"
34
+ primary_keys = ("id",)
35
+ replication_key = "created_at"
36
+ openapi_ref = "TaxDeclaration"
37
+
38
+
39
+ class TaxRetentions(BelvoStream):
40
+ """Tax Retentions stream."""
41
+
42
+ name = "fiscal_tax_retentions"
43
+ path = "/api/tax-retentions"
44
+ primary_keys = ("id",)
45
+ replication_key = "created_at"
46
+ openapi_ref = "TaxRetentions"
47
+
48
+
49
+ class TaxReturns(BelvoStream):
50
+ """Tax Returns stream."""
51
+
52
+ name = "fiscal_tax_returns"
53
+ path = "/api/tax-returns"
54
+ primary_keys = ("id",)
55
+ replication_key = "created_at"
56
+ openapi_ref = "TaxReturn"
57
+
58
+
59
+ class TaxStatuses(BelvoStream):
60
+ """Tax Statuses stream."""
61
+
62
+ name = "fiscal_tax_statuses"
63
+ path = "/api/tax-status"
64
+ primary_keys = ("id",)
65
+ replication_key = "created_at"
66
+ openapi_ref = "TaxStatusSat"
tap_belvo/tap.py ADDED
@@ -0,0 +1,74 @@
1
+ """Belvo tap class."""
2
+
3
+ from __future__ import annotations
4
+
5
+ import sys
6
+
7
+ import singer_sdk
8
+ from singer_sdk import typing as th
9
+
10
+ from tap_belvo.streams import banking, core, enrichment, fiscal
11
+
12
+ if sys.version_info >= (3, 12):
13
+ from typing import override
14
+ else:
15
+ from typing_extensions import override
16
+
17
+
18
+ class TapBelvo(singer_sdk.Tap):
19
+ """Singer tap for Belvo."""
20
+
21
+ name = "tap-belvo"
22
+
23
+ config_jsonschema = th.PropertiesList(
24
+ th.Property(
25
+ "secret_id",
26
+ th.StringType,
27
+ description="Belvo API secret ID.",
28
+ required=True,
29
+ secret=True,
30
+ ),
31
+ th.Property(
32
+ "password",
33
+ th.StringType,
34
+ description="Belvo API password.",
35
+ required=True,
36
+ secret=True,
37
+ ),
38
+ th.Property(
39
+ "start_date",
40
+ th.DateTimeType,
41
+ description="Earliest datetime to get data from",
42
+ ),
43
+ th.Property(
44
+ "base_url",
45
+ th.StringType,
46
+ description="Base URL for the Belvo API",
47
+ default="https://development.belvo.com",
48
+ ),
49
+ ).to_dict()
50
+
51
+ @override
52
+ def discover_streams(self) -> list[singer_sdk.Stream]:
53
+ # TODO(edgarrmondragon): Add tax declarations and tax returns
54
+ # https://github.com/reservoir-data/tap-belvo/issues/76
55
+ return [
56
+ core.Links(self),
57
+ core.Institutions(self),
58
+ # TODO(edgarrmondragon): The `document_number` field seems to be incorrectly
59
+ # marked as required?
60
+ # https://developers.belvo.com/apis/belvoopenapispec/consents/listconsents
61
+ # core.Consents(self), # noqa: ERA001
62
+ banking.Accounts(self),
63
+ banking.Transactions(self),
64
+ banking.Owners(self),
65
+ # banking.InvestmentPortfolios(self), # noqa: ERA001
66
+ # banking.ReceivableTransactions(self), # noqa: ERA001
67
+ enrichment.Incomes(self),
68
+ enrichment.RecurringExpenses(self),
69
+ enrichment.RiskInsights(self),
70
+ fiscal.Invoices(self),
71
+ fiscal.TaxComplianceStatuses(self),
72
+ fiscal.TaxRetentions(self),
73
+ fiscal.TaxStatuses(self),
74
+ ]
@@ -0,0 +1,110 @@
1
+ Metadata-Version: 2.4
2
+ Name: tap-belvo
3
+ Version: 0.3.5
4
+ Summary: Singer tap for Belvo, built with the Meltano SDK for Singer Taps.
5
+ Project-URL: Documentation, https://github.com/reservoir-data/tap-belvo#readme
6
+ Project-URL: Homepage, https://github.com/reservoir-data/tap-belvo
7
+ Project-URL: Source, https://github.com/reservoir-data/tap-belvo
8
+ Author-email: Edgar Ramírez-Mondragón <edgarrm358@gmail.com>
9
+ Maintainer-email: Edgar Ramírez-Mondragón <edgarrm358@gmail.com>
10
+ License-Expression: Apache-2.0
11
+ License-File: LICENSE
12
+ Keywords: Belvo,ELT,singer.io
13
+ Classifier: Programming Language :: Python :: 3 :: Only
14
+ Classifier: Programming Language :: Python :: 3.11
15
+ Classifier: Programming Language :: Python :: 3.12
16
+ Classifier: Programming Language :: Python :: 3.13
17
+ Classifier: Programming Language :: Python :: 3.14
18
+ Requires-Python: >=3.11
19
+ Requires-Dist: requests-cache==1.*
20
+ Requires-Dist: requests~=2.32.3
21
+ Requires-Dist: singer-sdk~=0.53.2
22
+ Requires-Dist: typing-extensions>=4.15; python_full_version < '3.12'
23
+ Description-Content-Type: text/markdown
24
+
25
+ # tap-belvo
26
+
27
+ Singer tap for Belvo.
28
+
29
+ Built with the [Meltano Singer SDK](https://sdk.meltano.com).
30
+
31
+ ## Capabilities
32
+
33
+ * `catalog`
34
+ * `state`
35
+ * `discover`
36
+ * `about`
37
+ * `stream-maps`
38
+ * `schema-flattening`
39
+
40
+ ## Settings
41
+
42
+ | Setting | Required | Default | Description |
43
+ |:--------------------|:--------:|:-------:|:------------|
44
+ | secret_id | True | None | Belvo API secret ID. |
45
+ | password | True | None | Belvo API password. |
46
+ | start_date | False | None | Earliest datetime to get data from |
47
+ | base_url | False | https://development.belvo.com | Base URL for the Belvo API |
48
+ | stream_maps | False | None | Config object for stream maps capability. For more information check out [Stream Maps](https://sdk.meltano.com/en/latest/stream_maps.html). |
49
+ | stream_map_config | False | None | User-defined config values to be used within map expressions. |
50
+ | flattening_enabled | False | None | 'True' to enable schema flattening and automatically expand nested properties. |
51
+ | flattening_max_depth| False | None | The max depth to flatten schemas. |
52
+
53
+ A full list of supported settings and capabilities is available by running: `tap-belvo --about`
54
+
55
+ ### Source Authentication and Authorization
56
+
57
+ See https://developers.belvo.com/reference/authentication-1.
58
+
59
+ ## Usage
60
+
61
+ You can easily run `tap-belvo` by itself or in a pipeline using [Meltano](https://meltano.com/).
62
+
63
+ ### Executing the Tap Directly
64
+
65
+ ```bash
66
+ tap-belvo --version
67
+ tap-belvo --help
68
+ tap-belvo --config CONFIG --discover > ./catalog.json
69
+ ```
70
+
71
+ ## Developer Resources
72
+
73
+ ### Initialize your Development Environment
74
+
75
+ ```bash
76
+ uv tool install --with tox-uv tox
77
+ ```
78
+
79
+ ### Create and Run Tests
80
+
81
+ Run all tests:
82
+
83
+ ```bash
84
+ tox run-parallel
85
+ ```
86
+
87
+ ### Testing with [Meltano](https://www.meltano.com)
88
+
89
+ _**Note:** This tap will work in any Singer environment and does not require Meltano.
90
+ Examples here are for convenience and to streamline end-to-end orchestration scenarios._
91
+
92
+ Your project comes with a custom `meltano.yml` project file already created. Go ahead and [install Meltano](https://docs.meltano.com/getting-started/installation/) if you haven't already.
93
+
94
+ 1. Install all plugins
95
+
96
+ ```bash
97
+ meltano install
98
+ ```
99
+
100
+ 1. Check that the extractor is working properly
101
+
102
+ ```bash
103
+ meltano invoke tap-belvo --version
104
+ ```
105
+
106
+ 1. Execute an ELT pipeline
107
+
108
+ ```bash
109
+ meltano run tap-belvo target-jsonl
110
+ ```
@@ -0,0 +1,15 @@
1
+ tap_belvo/__init__.py,sha256=iyiBrJmF2aO9lg9B8vvrJlfGSSg0I2JooKI4TOFqbtY,80
2
+ tap_belvo/__main__.py,sha256=J5_xhlTVBRRUlQ62HlFpgvpDXaeYZqEpb1-eEO0rSJg,110
3
+ tap_belvo/client.py,sha256=9umJFleWiXI2zsWa51bLwl2dAeW7Aax8Ks0FfINHgNA,3663
4
+ tap_belvo/openapi.json,sha256=s5by63pAwVcpKzl4Ym04KWUek9CAbDG8IZ-wYazZ87E,1617968
5
+ tap_belvo/tap.py,sha256=U8RZsAC8gSxAOrjSBgmB7k3ntmVslxXksfmEwdlv4QE,2257
6
+ tap_belvo/streams/__init__.py,sha256=pbZNHP8IAnavfiIpY2vNZevOyieVmjwmjrsNEYEIY1M,935
7
+ tap_belvo/streams/banking.py,sha256=8IYbtUwDoUSjOxFbkEFSDC8QK9urLJyU0JvOJkNjIww,2421
8
+ tap_belvo/streams/core.py,sha256=Kr991miUOD3kNu2eh4GGjBBHHrdRTPDD2FGa3swIhYg,1131
9
+ tap_belvo/streams/enrichment.py,sha256=oiyXvkSK2XRcGjcpfbeTW454eyNGhO-eejdEnuHOFYg,761
10
+ tap_belvo/streams/fiscal.py,sha256=P1kM1TN-Im1XCiTipG-OiKTfbgy0uoW_sg_-D7EnJQo,1603
11
+ tap_belvo-0.3.5.dist-info/METADATA,sha256=j5n32ydIDD8TvRyf3GkJn0tTjGLaF6fmcT9-NVvLpzc,3501
12
+ tap_belvo-0.3.5.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
13
+ tap_belvo-0.3.5.dist-info/entry_points.txt,sha256=mbs2jnK3SrSgW3kjbO1jMZdQkSAKw-JO8SscyYtN_Pg,57
14
+ tap_belvo-0.3.5.dist-info/licenses/LICENSE,sha256=hYHcZxy5jb9T_KQO1dQVotQfhWsU2XBotWBg6FIgklM,1068
15
+ tap_belvo-0.3.5.dist-info/RECORD,,
@@ -0,0 +1,4 @@
1
+ Wheel-Version: 1.0
2
+ Generator: hatchling 1.27.0
3
+ Root-Is-Purelib: true
4
+ Tag: py3-none-any
@@ -0,0 +1,2 @@
1
+ [console_scripts]
2
+ tap-belvo = tap_belvo.tap:TapBelvo.cli
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2022 Edgar R. M.
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.