-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy path__init__.py
More file actions
124 lines (113 loc) · 3.07 KB
/
Copy path__init__.py
File metadata and controls
124 lines (113 loc) · 3.07 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
"""
FinWise Python SDK (Unofficial).
An unofficial, community-maintained Python client for the FinWise API.
This project is not affiliated with or endorsed by FinWise.
Quick Start:
>>> from finwise import FinWise
>>>
>>> # Initialize the client
>>> client = FinWise(api_key="your-api-key")
>>>
>>> # List accounts
>>> accounts = client.accounts.list()
>>> for account in accounts:
... print(account.name)
>>>
>>> # Create a transaction
>>> from decimal import Decimal
>>> from datetime import date
>>>
>>> transaction = client.transactions.create(
... account_id="acc_123",
... amount=Decimal("-50.00"),
... transaction_date=date.today(),
... description="Coffee",
... type="expense",
... )
Environment Variable:
You can set your API key via the FINWISE_API_KEY environment variable:
>>> import os
>>> os.environ["FINWISE_API_KEY"] = "your-api-key"
>>> client = FinWise() # Uses env var automatically
Error Handling:
>>> from finwise import FinWise, NotFoundError, AuthenticationError
>>>
>>> client = FinWise(api_key="your-api-key")
>>> try:
... account = client.accounts.retrieve("invalid_id")
... except NotFoundError as e:
... print(f"Account not found: {e.message}")
... except AuthenticationError as e:
... print(f"Invalid API key: {e.message}")
For more information, visit: https://finwiseapp.io/docs/api
"""
from finwise._client import FinWise
from finwise._version import __version__
# Exceptions
from finwise.exceptions import (
AuthenticationError,
ConflictError,
FinWiseAPIError,
FinWiseConnectionError,
FinWiseError,
FinWiseTimeoutError,
NotFoundError,
PermissionDeniedError,
RateLimitError,
ServerError,
ValidationError,
)
# Models
from finwise.models import (
Account,
AccountBalance,
AccountBalanceCreateRequest,
AccountCreateRequest,
AccountUpdateRequest,
AggregatedBalance,
AggregatedCategoryBudget,
AggregatedTransaction,
Transaction,
TransactionCategory,
TransactionCategoryCreateRequest,
TransactionCreateRequest,
)
# Types
from finwise.types.pagination import PaginatedResponse
__all__ = [
# Version
"__version__",
# Client
"FinWise",
# Exceptions
"FinWiseError",
"FinWiseAPIError",
"AuthenticationError",
"PermissionDeniedError",
"NotFoundError",
"ValidationError",
"ConflictError",
"RateLimitError",
"ServerError",
"FinWiseConnectionError",
"FinWiseTimeoutError",
# Models - Account
"Account",
"AccountCreateRequest",
"AccountUpdateRequest",
# Models - Account Balance
"AccountBalance",
"AccountBalanceCreateRequest",
"AggregatedBalance",
# Models - Category Budget
"AggregatedCategoryBudget",
# Models - Transaction
"AggregatedTransaction",
"Transaction",
"TransactionCreateRequest",
# Models - Transaction Category
"TransactionCategory",
"TransactionCategoryCreateRequest",
# Types
"PaginatedResponse",
]