python-moloni-fix 0.3.16__tar.gz

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.
Files changed (57) hide show
  1. python_moloni_fix-0.3.16/LICENSE +21 -0
  2. python_moloni_fix-0.3.16/PKG-INFO +231 -0
  3. python_moloni_fix-0.3.16/README.md +204 -0
  4. python_moloni_fix-0.3.16/moloni/__init__.py +0 -0
  5. python_moloni_fix-0.3.16/moloni/__version__.py +1 -0
  6. python_moloni_fix-0.3.16/moloni/api/__init__.py +701 -0
  7. python_moloni_fix-0.3.16/moloni/api/bankaccounts_client.py +372 -0
  8. python_moloni_fix-0.3.16/moloni/api/billsoflading_client.py +693 -0
  9. python_moloni_fix-0.3.16/moloni/api/companies_client.py +322 -0
  10. python_moloni_fix-0.3.16/moloni/api/countries_client.py +171 -0
  11. python_moloni_fix-0.3.16/moloni/api/creditnotes_client.py +615 -0
  12. python_moloni_fix-0.3.16/moloni/api/currencies_client.py +171 -0
  13. python_moloni_fix-0.3.16/moloni/api/customeralternateaddresses_client.py +519 -0
  14. python_moloni_fix-0.3.16/moloni/api/customerreturnnotes_client.py +701 -0
  15. python_moloni_fix-0.3.16/moloni/api/customers_client.py +1413 -0
  16. python_moloni_fix-0.3.16/moloni/api/debitnotes_client.py +597 -0
  17. python_moloni_fix-0.3.16/moloni/api/deductions_client.py +435 -0
  18. python_moloni_fix-0.3.16/moloni/api/deliverymethods_client.py +431 -0
  19. python_moloni_fix-0.3.16/moloni/api/deliverynotes_client.py +714 -0
  20. python_moloni_fix-0.3.16/moloni/api/documentmodels_client.py +171 -0
  21. python_moloni_fix-0.3.16/moloni/api/documents_client.py +472 -0
  22. python_moloni_fix-0.3.16/moloni/api/documentsets_client.py +447 -0
  23. python_moloni_fix-0.3.16/moloni/api/estimates_client.py +663 -0
  24. python_moloni_fix-0.3.16/moloni/api/fiscalzones_client.py +219 -0
  25. python_moloni_fix-0.3.16/moloni/api/identificationtemplates_client.py +513 -0
  26. python_moloni_fix-0.3.16/moloni/api/invoicereceipts_client.py +705 -0
  27. python_moloni_fix-0.3.16/moloni/api/invoices_client.py +705 -0
  28. python_moloni_fix-0.3.16/moloni/api/languages_client.py +171 -0
  29. python_moloni_fix-0.3.16/moloni/api/maturitydates_client.py +441 -0
  30. python_moloni_fix-0.3.16/moloni/api/measurementunits_client.py +437 -0
  31. python_moloni_fix-0.3.16/moloni/api/ownassetsmovementguides_client.py +683 -0
  32. python_moloni_fix-0.3.16/moloni/api/paymentmethods_client.py +429 -0
  33. python_moloni_fix-0.3.16/moloni/api/productcategories_client.py +400 -0
  34. python_moloni_fix-0.3.16/moloni/api/products_client.py +1252 -0
  35. python_moloni_fix-0.3.16/moloni/api/receipts_client.py +591 -0
  36. python_moloni_fix-0.3.16/moloni/api/salesmen_client.py +580 -0
  37. python_moloni_fix-0.3.16/moloni/api/simplifiedinvoices_client.py +705 -0
  38. python_moloni_fix-0.3.16/moloni/api/subscription_client.py +104 -0
  39. python_moloni_fix-0.3.16/moloni/api/suppliers_client.py +1264 -0
  40. python_moloni_fix-0.3.16/moloni/api/taxes_client.py +477 -0
  41. python_moloni_fix-0.3.16/moloni/api/taxexemptions_client.py +171 -0
  42. python_moloni_fix-0.3.16/moloni/api/users_client.py +104 -0
  43. python_moloni_fix-0.3.16/moloni/api/vehicles_client.py +435 -0
  44. python_moloni_fix-0.3.16/moloni/api/warehouses_client.py +506 -0
  45. python_moloni_fix-0.3.16/moloni/api/waybills_client.py +699 -0
  46. python_moloni_fix-0.3.16/moloni/base/__init__.py +24 -0
  47. python_moloni_fix-0.3.16/moloni/base/client.py +164 -0
  48. python_moloni_fix-0.3.16/moloni/base/config.py +6 -0
  49. python_moloni_fix-0.3.16/moloni/base/helpers.py +150 -0
  50. python_moloni_fix-0.3.16/moloni/base/logger_config.py +49 -0
  51. python_moloni_fix-0.3.16/python_moloni_fix.egg-info/PKG-INFO +231 -0
  52. python_moloni_fix-0.3.16/python_moloni_fix.egg-info/SOURCES.txt +56 -0
  53. python_moloni_fix-0.3.16/python_moloni_fix.egg-info/dependency_links.txt +1 -0
  54. python_moloni_fix-0.3.16/python_moloni_fix.egg-info/requires.txt +10 -0
  55. python_moloni_fix-0.3.16/python_moloni_fix.egg-info/top_level.txt +1 -0
  56. python_moloni_fix-0.3.16/setup.cfg +9 -0
  57. python_moloni_fix-0.3.16/setup.py +19 -0
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2020 Michael Primke
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.
@@ -0,0 +1,231 @@
1
+ Metadata-Version: 2.4
2
+ Name: python-moloni-fix
3
+ Version: 0.3.16
4
+ Summary: Python wrapper for the Moloni API
5
+ Home-page: https://github.com/zedomel/python-moloni
6
+ Author: José Augusto Salim
7
+ Author-email: zedomel@gmail.com
8
+ License: MIT
9
+ Description-Content-Type: text/markdown
10
+ License-File: LICENSE
11
+ Requires-Dist: requests
12
+ Requires-Dist: cachetools>=4.2
13
+ Requires-Dist: pydantic
14
+ Provides-Extra: aws-caching
15
+ Requires-Dist: aws-secretsmanager-caching; extra == "aws-caching"
16
+ Requires-Dist: boto3; extra == "aws-caching"
17
+ Provides-Extra: aws
18
+ Requires-Dist: boto3; extra == "aws"
19
+ Dynamic: author
20
+ Dynamic: author-email
21
+ Dynamic: home-page
22
+ Dynamic: license
23
+ Dynamic: license-file
24
+ Dynamic: provides-extra
25
+ Dynamic: requires-dist
26
+ Dynamic: summary
27
+
28
+ PYTHON-MOLONI
29
+ ==============
30
+
31
+ Welcome to the Moloni API Client! This Python package provides a simple and flexible way to interact with the Moloni API. It supports a wide range of endpoints and allows you to manage your Moloni account programmatically.
32
+
33
+ ## Table of Contents
34
+
35
+ - [Features](#features)
36
+ - [Installation](#installation)
37
+ - [Documentation](#documentation)
38
+ - [Usage](#usage)
39
+ - [Full Configuration](#full-configuration)
40
+ - [Models as Entrypoints](#models-as-entrypoints)
41
+ - [Minimal Configuration](#minimal-configuration)
42
+ - [Credentials](#credentials)
43
+ - [API Response Handling](#api-response-handling)
44
+ - [Supported Endpoints](#supported-endpoints)
45
+ - [License](#license)
46
+
47
+ ## Features
48
+
49
+ - **Comprehensive Coverage:** Supports all Moloni API endpoints.
50
+ - **Flexible Configuration:** Easily configure and authenticate your requests.
51
+ - **Built-in Models:** Utilize predefined Pydantic models for request validation.
52
+
53
+
54
+ ## Installation
55
+
56
+ You can install the Moloni API Client using pip:
57
+
58
+ ```bash
59
+ pip install python-moloni
60
+ ```
61
+
62
+ ## Documentation
63
+
64
+ [Documentation is available here](https://python-moloni.readthedocs.io/en/latest/index.html)
65
+
66
+ ## Usage
67
+
68
+ ### Full Configuration
69
+
70
+ You can set up a fully configured client with all necessary authentication details:
71
+
72
+ ```python
73
+ from moloni.api.companies_client import CompaniesClient
74
+ from moloni.base import AuthConfig, MoloniBaseUrl
75
+ import logging
76
+
77
+ logger = logging.getLogger(__name__)
78
+
79
+ companies = CompaniesClient(
80
+ environment=MoloniBaseUrl.PROD,
81
+ auth_config=AuthConfig(
82
+ client_id="your_client_id",
83
+ client_secret="your_client_secret",
84
+ username="your_username", # Optional if refresh_token is set
85
+ password="your_password", # Optional if refresh_token is set
86
+ refresh_token="your_refresh_token", # Optional if username and password are set
87
+ ),
88
+ log_level="INFO",
89
+ version="v1",
90
+ validate=True,
91
+ )
92
+ logger.info(companies.get_all())
93
+ ```
94
+
95
+ ### Models as Entrypoints
96
+
97
+ You can also use the predefined models as entrypoints to the API:
98
+
99
+ ```python
100
+ from moloni.api import CustomersGetBySearchModel
101
+ from moloni.base import AuthConfig, MoloniBaseUrl
102
+ from pprint import pprint
103
+
104
+ auth_config = AuthConfig(
105
+ client_id="your_client_id",
106
+ client_secret="your_client_secret",
107
+ username="your_username", # Optional if refresh_token is set
108
+ password="your_password", # Optional if refresh_token is set
109
+ refresh_token="your_refresh_token", # Optional if username and password are set
110
+ )
111
+
112
+ with CustomersGetBySearchModel(company_id=5, search="cafe").connect(
113
+ auth_config=auth_config
114
+ ) as api:
115
+ pprint(api.request().payload)
116
+
117
+ ```
118
+
119
+
120
+ ### Minimal Configuration
121
+
122
+ For a minimal setup, credentials can be passed via environment variables:
123
+
124
+ ```python
125
+ from moloni.api.companies_client import CompaniesClient
126
+ from moloni.api.products_client import ProductsClient, ProductsGetAllModel
127
+ import logging
128
+
129
+ logger = logging.getLogger(__name__)
130
+
131
+ companies = CompaniesClient()
132
+ logger.info(companies.get_all())
133
+ products = ProductsClient()
134
+ logger.info(products.get_all(dict(company_id=5, category_id=8231525)))
135
+
136
+ product = products.insert(
137
+ dict(
138
+ company_id=5,
139
+ category_id=123456,
140
+ unit_id=134568,
141
+ has_stock="0",
142
+ name="Name",
143
+ reference="Reference",
144
+ price="10",
145
+ type="1",
146
+ taxes=[{"tax_id": 123455, "order": 0, "cumulative": 0}],
147
+ )
148
+ )
149
+
150
+ # or with a model
151
+
152
+ products_response = products.get_all(
153
+ ProductsGetAllModel(company_id=5, category_id=8231525)
154
+ )
155
+ ```
156
+
157
+ ## Credentials
158
+
159
+ ### Passing Credentials
160
+
161
+ You can pass your credentials directly in the code or via environment variables:
162
+
163
+ ```python
164
+ from moloni.base import AuthConfig
165
+
166
+ auth_config = AuthConfig(
167
+ client_id='your_client_id',
168
+ client_secret='your_client_secret',
169
+ username='your_username',
170
+ password='your_password',
171
+ refresh_token='your_refresh_token'
172
+ )
173
+ ```
174
+
175
+ ### Environment Variables
176
+
177
+ Alternatively, set the following environment variables:
178
+
179
+ ```bash
180
+ export MOLONI_CLIENT_ID="your_client_id"
181
+ export MOLONI_CLIENT_SECRET="your_client_secret"
182
+ export MOLONI_REFRESH_TOKEN="your_refresh_token"
183
+ export MOLONI_USERNAME="your_username"
184
+ export MOLONI_PASSWORD="your_password"
185
+ ```
186
+
187
+ ## API Response Handling
188
+
189
+ The API responses are encapsulated in an ApiResponse object, which provides methods to access the response payload and handle pagination.
190
+
191
+ ### Example:
192
+
193
+ ```python
194
+ response = companies.get_all()
195
+ print(response.payload) # Access the JSON payload
196
+ print(response.status_code) # Check the HTTP status code
197
+
198
+ try:
199
+ next_page = response.next(qty=10)
200
+ print("Fetching next page with:", next_page)
201
+ except NoMoreRecords:
202
+ print("No more records to fetch.")
203
+ ```
204
+
205
+ ## Supported Endpoints
206
+
207
+ This client supports the full list of Moloni API endpoints, including:
208
+
209
+ • BankaccountsClient
210
+ • BillsofladingClient
211
+ • CompaniesClient
212
+ • CustomersClient
213
+ • InvoicesClient
214
+ • ProductsClient
215
+ • WarehousesClient
216
+
217
+ For a full list, please refer to the [documentation](https://python-moloni.readthedocs.io/en/latest/index.html).
218
+
219
+ ## License
220
+
221
+ This project is licensed under the MIT License. See the [LICENSE](LICENSE) file for details.
222
+
223
+ -------
224
+
225
+ [![Coverage](./coverage.svg)](./coverage.svg)
226
+
227
+ -------
228
+
229
+ ##### Disclaimer
230
+
231
+ We are not affiliated with Moloni, this is an unofficial wrapper to access their API. For more information, please visit their [official website](https://www.moloni.pt/).
@@ -0,0 +1,204 @@
1
+ PYTHON-MOLONI
2
+ ==============
3
+
4
+ Welcome to the Moloni API Client! This Python package provides a simple and flexible way to interact with the Moloni API. It supports a wide range of endpoints and allows you to manage your Moloni account programmatically.
5
+
6
+ ## Table of Contents
7
+
8
+ - [Features](#features)
9
+ - [Installation](#installation)
10
+ - [Documentation](#documentation)
11
+ - [Usage](#usage)
12
+ - [Full Configuration](#full-configuration)
13
+ - [Models as Entrypoints](#models-as-entrypoints)
14
+ - [Minimal Configuration](#minimal-configuration)
15
+ - [Credentials](#credentials)
16
+ - [API Response Handling](#api-response-handling)
17
+ - [Supported Endpoints](#supported-endpoints)
18
+ - [License](#license)
19
+
20
+ ## Features
21
+
22
+ - **Comprehensive Coverage:** Supports all Moloni API endpoints.
23
+ - **Flexible Configuration:** Easily configure and authenticate your requests.
24
+ - **Built-in Models:** Utilize predefined Pydantic models for request validation.
25
+
26
+
27
+ ## Installation
28
+
29
+ You can install the Moloni API Client using pip:
30
+
31
+ ```bash
32
+ pip install python-moloni
33
+ ```
34
+
35
+ ## Documentation
36
+
37
+ [Documentation is available here](https://python-moloni.readthedocs.io/en/latest/index.html)
38
+
39
+ ## Usage
40
+
41
+ ### Full Configuration
42
+
43
+ You can set up a fully configured client with all necessary authentication details:
44
+
45
+ ```python
46
+ from moloni.api.companies_client import CompaniesClient
47
+ from moloni.base import AuthConfig, MoloniBaseUrl
48
+ import logging
49
+
50
+ logger = logging.getLogger(__name__)
51
+
52
+ companies = CompaniesClient(
53
+ environment=MoloniBaseUrl.PROD,
54
+ auth_config=AuthConfig(
55
+ client_id="your_client_id",
56
+ client_secret="your_client_secret",
57
+ username="your_username", # Optional if refresh_token is set
58
+ password="your_password", # Optional if refresh_token is set
59
+ refresh_token="your_refresh_token", # Optional if username and password are set
60
+ ),
61
+ log_level="INFO",
62
+ version="v1",
63
+ validate=True,
64
+ )
65
+ logger.info(companies.get_all())
66
+ ```
67
+
68
+ ### Models as Entrypoints
69
+
70
+ You can also use the predefined models as entrypoints to the API:
71
+
72
+ ```python
73
+ from moloni.api import CustomersGetBySearchModel
74
+ from moloni.base import AuthConfig, MoloniBaseUrl
75
+ from pprint import pprint
76
+
77
+ auth_config = AuthConfig(
78
+ client_id="your_client_id",
79
+ client_secret="your_client_secret",
80
+ username="your_username", # Optional if refresh_token is set
81
+ password="your_password", # Optional if refresh_token is set
82
+ refresh_token="your_refresh_token", # Optional if username and password are set
83
+ )
84
+
85
+ with CustomersGetBySearchModel(company_id=5, search="cafe").connect(
86
+ auth_config=auth_config
87
+ ) as api:
88
+ pprint(api.request().payload)
89
+
90
+ ```
91
+
92
+
93
+ ### Minimal Configuration
94
+
95
+ For a minimal setup, credentials can be passed via environment variables:
96
+
97
+ ```python
98
+ from moloni.api.companies_client import CompaniesClient
99
+ from moloni.api.products_client import ProductsClient, ProductsGetAllModel
100
+ import logging
101
+
102
+ logger = logging.getLogger(__name__)
103
+
104
+ companies = CompaniesClient()
105
+ logger.info(companies.get_all())
106
+ products = ProductsClient()
107
+ logger.info(products.get_all(dict(company_id=5, category_id=8231525)))
108
+
109
+ product = products.insert(
110
+ dict(
111
+ company_id=5,
112
+ category_id=123456,
113
+ unit_id=134568,
114
+ has_stock="0",
115
+ name="Name",
116
+ reference="Reference",
117
+ price="10",
118
+ type="1",
119
+ taxes=[{"tax_id": 123455, "order": 0, "cumulative": 0}],
120
+ )
121
+ )
122
+
123
+ # or with a model
124
+
125
+ products_response = products.get_all(
126
+ ProductsGetAllModel(company_id=5, category_id=8231525)
127
+ )
128
+ ```
129
+
130
+ ## Credentials
131
+
132
+ ### Passing Credentials
133
+
134
+ You can pass your credentials directly in the code or via environment variables:
135
+
136
+ ```python
137
+ from moloni.base import AuthConfig
138
+
139
+ auth_config = AuthConfig(
140
+ client_id='your_client_id',
141
+ client_secret='your_client_secret',
142
+ username='your_username',
143
+ password='your_password',
144
+ refresh_token='your_refresh_token'
145
+ )
146
+ ```
147
+
148
+ ### Environment Variables
149
+
150
+ Alternatively, set the following environment variables:
151
+
152
+ ```bash
153
+ export MOLONI_CLIENT_ID="your_client_id"
154
+ export MOLONI_CLIENT_SECRET="your_client_secret"
155
+ export MOLONI_REFRESH_TOKEN="your_refresh_token"
156
+ export MOLONI_USERNAME="your_username"
157
+ export MOLONI_PASSWORD="your_password"
158
+ ```
159
+
160
+ ## API Response Handling
161
+
162
+ The API responses are encapsulated in an ApiResponse object, which provides methods to access the response payload and handle pagination.
163
+
164
+ ### Example:
165
+
166
+ ```python
167
+ response = companies.get_all()
168
+ print(response.payload) # Access the JSON payload
169
+ print(response.status_code) # Check the HTTP status code
170
+
171
+ try:
172
+ next_page = response.next(qty=10)
173
+ print("Fetching next page with:", next_page)
174
+ except NoMoreRecords:
175
+ print("No more records to fetch.")
176
+ ```
177
+
178
+ ## Supported Endpoints
179
+
180
+ This client supports the full list of Moloni API endpoints, including:
181
+
182
+ • BankaccountsClient
183
+ • BillsofladingClient
184
+ • CompaniesClient
185
+ • CustomersClient
186
+ • InvoicesClient
187
+ • ProductsClient
188
+ • WarehousesClient
189
+
190
+ For a full list, please refer to the [documentation](https://python-moloni.readthedocs.io/en/latest/index.html).
191
+
192
+ ## License
193
+
194
+ This project is licensed under the MIT License. See the [LICENSE](LICENSE) file for details.
195
+
196
+ -------
197
+
198
+ [![Coverage](./coverage.svg)](./coverage.svg)
199
+
200
+ -------
201
+
202
+ ##### Disclaimer
203
+
204
+ We are not affiliated with Moloni, this is an unofficial wrapper to access their API. For more information, please visit their [official website](https://www.moloni.pt/).
File without changes
@@ -0,0 +1 @@
1
+ __version__ = '0.3.16'