resources
Monzo API 'pots' resource.
PotsResource
dataclass
Bases: BaseResource
Monzo API 'pots' resource.
Note
Monzo API docs: https://monzo.com/docs/#pots
Source code in pymonzo/pots/resources.py
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 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 | |
deposit(amount, pot_id=None, *, account_id=None, dedupe_id=None)
Move money from an account to a pot.
Note
Monzo API docs: https://docs.monzo.com/#deposit-into-a-pot
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
amount |
Union[int, float]
|
The amount to deposit, as a 64bit integer in minor units of the currency, eg. pennies for GBP, or cents for EUR and USD. |
required |
pot_id |
Optional[str]
|
The ID of the pot to deposit into. |
None
|
account_id |
Optional[str]
|
The ID of the account to withdraw from. Can be omitted if user has only one active account. |
None
|
dedupe_id |
Optional[str]
|
A unique string used to de-duplicate deposits. Ensure this remains static between retries to ensure only one deposit is created. If omitted, a random 16 character string will be generated. |
None
|
Returns:
| Type | Description |
|---|---|
MonzoPot
|
A Monzo pot. |
Raises:
| Type | Description |
|---|---|
CannotDetermineDefaultPot
|
If user has more than one active pot. |
CannotDetermineDefaultAccount
|
If no account ID was passed and default account cannot be determined. |
Source code in pymonzo/pots/resources.py
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 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 | |
get_default_pot(account_id=None)
If the user has only one (active) pot, treat it as the default pot.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
account_id |
Optional[str]
|
The ID of the account. Can be omitted if user has only one active account. |
None
|
Returns:
| Type | Description |
|---|---|
MonzoPot
|
User's active pot. |
Raises:
| Type | Description |
|---|---|
CannotDetermineDefaultPot
|
If user has more than one active pot. |
CannotDetermineDefaultAccount
|
If no account ID was passed and default account cannot be determined. |
Source code in pymonzo/pots/resources.py
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 | |
list(account_id=None, *, refresh=False)
Return a list of user's pots.
It's often used when deciding whether to require explicit pot ID or use the only active one, so we cache the response by default.
Note
Monzo API docs: https://docs.monzo.com/#list-pots
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
account_id |
Optional[str]
|
The ID of the account. Can be omitted if user has only one active account. |
None
|
refresh |
bool
|
Whether to refresh the cached list of pots. |
False
|
Returns:
| Type | Description |
|---|---|
List[MonzoPot]
|
A list of user's pots. |
Raises:
| Type | Description |
|---|---|
CannotDetermineDefaultAccount
|
If no account ID was passed and default account cannot be determined. |
Source code in pymonzo/pots/resources.py
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 | |
withdraw(amount, pot_id=None, *, account_id=None, dedupe_id=None)
Withdraw money from a pot to an account.
Note
Monzo API docs: https://docs.monzo.com/#withdraw-from-a-pot
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
amount |
Union[int, float]
|
The amount to deposit, as a 64bit integer in minor units of the currency, eg. pennies for GBP, or cents for EUR and USD. |
required |
pot_id |
Optional[str]
|
The ID of the pot to withdraw from. |
None
|
account_id |
Optional[str]
|
The ID of the account to deposit into. Can be omitted if user has only one active account. |
None
|
dedupe_id |
Optional[str]
|
A unique string used to de-duplicate deposits. Ensure this remains static between retries to ensure only one deposit is created. If omitted, a random 16 character string will be generated. |
None
|
Returns:
| Type | Description |
|---|---|
MonzoPot
|
A Monzo pot. |
Raises:
| Type | Description |
|---|---|
CannotDetermineDefaultPot
|
If user has more than one active pot. |
CannotDetermineDefaultAccount
|
If no account ID was passed and default account cannot be determined. |
Source code in pymonzo/pots/resources.py
150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 | |