prestashop-webservice 0.2.0__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 (38) hide show
  1. prestashop_webservice-0.2.0/.github/workflows/publish.yml +56 -0
  2. prestashop_webservice-0.2.0/.gitignore +211 -0
  3. prestashop_webservice-0.2.0/.pre-commit-config.yaml +24 -0
  4. prestashop_webservice-0.2.0/LICENSE +21 -0
  5. prestashop_webservice-0.2.0/PKG-INFO +97 -0
  6. prestashop_webservice-0.2.0/README.md +53 -0
  7. prestashop_webservice-0.2.0/docs/INSTALLATION.md +93 -0
  8. prestashop_webservice-0.2.0/docs/USAGE.md +257 -0
  9. prestashop_webservice-0.2.0/pyproject.toml +80 -0
  10. prestashop_webservice-0.2.0/requirements.txt +14 -0
  11. prestashop_webservice-0.2.0/setup.cfg +4 -0
  12. prestashop_webservice-0.2.0/src/prestashop_webservice/__init__.py +62 -0
  13. prestashop_webservice-0.2.0/src/prestashop_webservice/address.py +29 -0
  14. prestashop_webservice-0.2.0/src/prestashop_webservice/base_model.py +63 -0
  15. prestashop_webservice-0.2.0/src/prestashop_webservice/client.py +134 -0
  16. prestashop_webservice-0.2.0/src/prestashop_webservice/config.py +9 -0
  17. prestashop_webservice-0.2.0/src/prestashop_webservice/country.py +30 -0
  18. prestashop_webservice-0.2.0/src/prestashop_webservice/customer.py +42 -0
  19. prestashop_webservice-0.2.0/src/prestashop_webservice/image_product.py +12 -0
  20. prestashop_webservice-0.2.0/src/prestashop_webservice/logger.py +31 -0
  21. prestashop_webservice-0.2.0/src/prestashop_webservice/models.py +324 -0
  22. prestashop_webservice-0.2.0/src/prestashop_webservice/order.py +101 -0
  23. prestashop_webservice-0.2.0/src/prestashop_webservice/order_carrier.py +33 -0
  24. prestashop_webservice-0.2.0/src/prestashop_webservice/order_history.py +54 -0
  25. prestashop_webservice-0.2.0/src/prestashop_webservice/order_state.py +12 -0
  26. prestashop_webservice-0.2.0/src/prestashop_webservice/params.py +69 -0
  27. prestashop_webservice-0.2.0/src/prestashop_webservice/product.py +54 -0
  28. prestashop_webservice-0.2.0/src/prestashop_webservice/py.typed +2 -0
  29. prestashop_webservice-0.2.0/src/prestashop_webservice/state.py +12 -0
  30. prestashop_webservice-0.2.0/src/prestashop_webservice.egg-info/PKG-INFO +97 -0
  31. prestashop_webservice-0.2.0/src/prestashop_webservice.egg-info/SOURCES.txt +36 -0
  32. prestashop_webservice-0.2.0/src/prestashop_webservice.egg-info/dependency_links.txt +1 -0
  33. prestashop_webservice-0.2.0/src/prestashop_webservice.egg-info/requires.txt +10 -0
  34. prestashop_webservice-0.2.0/src/prestashop_webservice.egg-info/top_level.txt +1 -0
  35. prestashop_webservice-0.2.0/tests/__init__.py +0 -0
  36. prestashop_webservice-0.2.0/tests/conftest.py +47 -0
  37. prestashop_webservice-0.2.0/tests/test_client.py +278 -0
  38. prestashop_webservice-0.2.0/tests/test_models.py +473 -0
@@ -0,0 +1,56 @@
1
+ name: Publish to PyPI
2
+
3
+ on:
4
+ release:
5
+ types: [published]
6
+ workflow_dispatch:
7
+
8
+ permissions:
9
+ id-token: write
10
+ contents: read
11
+
12
+ jobs:
13
+ build:
14
+ name: Build distribution
15
+ runs-on: ubuntu-latest
16
+
17
+ steps:
18
+ - uses: actions/checkout@v5
19
+
20
+ - name: Set up Python
21
+ uses: actions/setup-python@v6
22
+ with:
23
+ python-version: "3.12"
24
+
25
+ - name: Install build dependencies
26
+ run: |
27
+ python -m pip install --upgrade pip
28
+ pip install build
29
+
30
+ - name: Build package
31
+ run: python -m build
32
+
33
+ - name: Store the distribution packages
34
+ uses: actions/upload-artifact@v5
35
+ with:
36
+ name: python-package-distributions
37
+ path: dist/
38
+
39
+ publish-to-pypi:
40
+ name: Publish to PyPI
41
+ needs:
42
+ - build
43
+ runs-on: ubuntu-latest
44
+ environment:
45
+ name: pypi
46
+ url: https://pypi.org/p/prestashop-webservice
47
+
48
+ steps:
49
+ - name: Download all the dists
50
+ uses: actions/download-artifact@v6
51
+ with:
52
+ name: python-package-distributions
53
+ path: dist/
54
+
55
+ - name: Publish distribution to PyPI
56
+ uses: pypa/gh-action-pypi-publish@release/v1
@@ -0,0 +1,211 @@
1
+ # Byte-compiled / optimized / DLL files
2
+ __pycache__/
3
+ *.py[codz]
4
+ *$py.class
5
+
6
+ # C extensions
7
+ *.so
8
+
9
+ # Distribution / packaging
10
+ .Python
11
+ build/
12
+ develop-eggs/
13
+ dist/
14
+ downloads/
15
+ eggs/
16
+ .eggs/
17
+ lib/
18
+ lib64/
19
+ parts/
20
+ sdist/
21
+ var/
22
+ wheels/
23
+ share/python-wheels/
24
+ *.egg-info/
25
+ .installed.cfg
26
+ *.egg
27
+ MANIFEST
28
+
29
+ # PyInstaller
30
+ # Usually these files are written by a python script from a template
31
+ # before PyInstaller builds the exe, so as to inject date/other infos into it.
32
+ *.manifest
33
+ *.spec
34
+
35
+ # Installer logs
36
+ pip-log.txt
37
+ pip-delete-this-directory.txt
38
+
39
+ # Unit test / coverage reports
40
+ htmlcov/
41
+ .tox/
42
+ .nox/
43
+ .coverage
44
+ .coverage.*
45
+ .cache
46
+ nosetests.xml
47
+ coverage.xml
48
+ *.cover
49
+ *.py.cover
50
+ .hypothesis/
51
+ .pytest_cache/
52
+ cover/
53
+
54
+ # Translations
55
+ *.mo
56
+ *.pot
57
+
58
+ # Django stuff:
59
+ *.log
60
+ local_settings.py
61
+ db.sqlite3
62
+ db.sqlite3-journal
63
+
64
+ # Flask stuff:
65
+ instance/
66
+ .webassets-cache
67
+
68
+ # Scrapy stuff:
69
+ .scrapy
70
+
71
+ # Sphinx documentation
72
+ docs/_build/
73
+
74
+ # PyBuilder
75
+ .pybuilder/
76
+ target/
77
+
78
+ # Jupyter Notebook
79
+ .ipynb_checkpoints
80
+
81
+ # IPython
82
+ profile_default/
83
+ ipython_config.py
84
+
85
+ # pyenv
86
+ # For a library or package, you might want to ignore these files since the code is
87
+ # intended to run in multiple environments; otherwise, check them in:
88
+ # .python-version
89
+
90
+ # pipenv
91
+ # According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
92
+ # However, in case of collaboration, if having platform-specific dependencies or dependencies
93
+ # having no cross-platform support, pipenv may install dependencies that don't work, or not
94
+ # install all needed dependencies.
95
+ #Pipfile.lock
96
+
97
+ # UV
98
+ # Similar to Pipfile.lock, it is generally recommended to include uv.lock in version control.
99
+ # This is especially recommended for binary packages to ensure reproducibility, and is more
100
+ # commonly ignored for libraries.
101
+ #uv.lock
102
+
103
+ # poetry
104
+ # Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control.
105
+ # This is especially recommended for binary packages to ensure reproducibility, and is more
106
+ # commonly ignored for libraries.
107
+ # https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control
108
+ #poetry.lock
109
+ #poetry.toml
110
+
111
+ # pdm
112
+ # Similar to Pipfile.lock, it is generally recommended to include pdm.lock in version control.
113
+ # pdm recommends including project-wide configuration in pdm.toml, but excluding .pdm-python.
114
+ # https://pdm-project.org/en/latest/usage/project/#working-with-version-control
115
+ #pdm.lock
116
+ #pdm.toml
117
+ .pdm-python
118
+ .pdm-build/
119
+
120
+ # pixi
121
+ # Similar to Pipfile.lock, it is generally recommended to include pixi.lock in version control.
122
+ #pixi.lock
123
+ # Pixi creates a virtual environment in the .pixi directory, just like venv module creates one
124
+ # in the .venv directory. It is recommended not to include this directory in version control.
125
+ .pixi
126
+
127
+ # PEP 582; used by e.g. github.com/David-OConnor/pyflow and github.com/pdm-project/pdm
128
+ __pypackages__/
129
+
130
+ # Celery stuff
131
+ celerybeat-schedule
132
+ celerybeat.pid
133
+
134
+ # SageMath parsed files
135
+ *.sage.py
136
+
137
+ # Environments
138
+ .env
139
+ .envrc
140
+ .venv
141
+ env/
142
+ venv/
143
+ ENV/
144
+ env.bak/
145
+ venv.bak/
146
+
147
+ # Spyder project settings
148
+ .spyderproject
149
+ .spyproject
150
+
151
+ # Rope project settings
152
+ .ropeproject
153
+
154
+ # mkdocs documentation
155
+ /site
156
+
157
+ # mypy
158
+ .mypy_cache/
159
+ .dmypy.json
160
+ dmypy.json
161
+
162
+ # Pyre type checker
163
+ .pyre/
164
+
165
+ # pytype static type analyzer
166
+ .pytype/
167
+
168
+ # Cython debug symbols
169
+ cython_debug/
170
+
171
+ # PyCharm
172
+ # JetBrains specific template is maintained in a separate JetBrains.gitignore that can
173
+ # be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore
174
+ # and can be added to the global gitignore or merged into this file. For a more nuclear
175
+ # option (not recommended) you can uncomment the following to ignore the entire idea folder.
176
+ #.idea/
177
+
178
+ # Abstra
179
+ # Abstra is an AI-powered process automation framework.
180
+ # Ignore directories containing user credentials, local state, and settings.
181
+ # Learn more at https://abstra.io/docs
182
+ .abstra/
183
+
184
+ # Visual Studio Code
185
+ # Visual Studio Code specific template is maintained in a separate VisualStudioCode.gitignore
186
+ # that can be found at https://github.com/github/gitignore/blob/main/Global/VisualStudioCode.gitignore
187
+ # and can be added to the global gitignore or merged into this file. However, if you prefer,
188
+ # you could uncomment the following to ignore the entire vscode folder
189
+ # .vscode/
190
+
191
+ # Ruff stuff:
192
+ .ruff_cache/
193
+
194
+ # PyPI configuration file
195
+ .pypirc
196
+
197
+ # Cursor
198
+ # Cursor is an AI-powered code editor. `.cursorignore` specifies files/directories to
199
+ # exclude from AI features like autocomplete and code analysis. Recommended for sensitive data
200
+ # refer to https://docs.cursor.com/context/ignore-files
201
+ .cursorignore
202
+ .cursorindexingignore
203
+
204
+ # Marimo
205
+ marimo/_static/
206
+ marimo/_lsp/
207
+ __marimo__/
208
+ logs/
209
+
210
+
211
+ .env.test
@@ -0,0 +1,24 @@
1
+ default_language_version:
2
+ python: python3.12
3
+ repos:
4
+ - repo: https://github.com/pre-commit/pre-commit-hooks
5
+ rev: v5.0.0
6
+ hooks:
7
+ - id: check-added-large-files
8
+ exclude: ^docs/
9
+ - id: check-toml
10
+ - id: check-yaml
11
+ args:
12
+ - --unsafe
13
+ - id: end-of-file-fixer
14
+ - id: trailing-whitespace
15
+ - repo: https://github.com/astral-sh/ruff-pre-commit
16
+ rev: v0.8.4
17
+ hooks:
18
+ - id: ruff
19
+ args:
20
+ - --fix
21
+ - id: ruff-format
22
+ ci:
23
+ autofix_commit_msg: 🎨 [pre-commit.ci] Auto format from pre-commit.com hooks
24
+ autoupdate_commit_msg: ⬆ [pre-commit.ci] pre-commit autoupdate
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2025 Patitas and Co
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,97 @@
1
+ Metadata-Version: 2.4
2
+ Name: prestashop-webservice
3
+ Version: 0.2.0
4
+ Summary: Webservice client for PrestaShop API
5
+ Author-email: Nestor Villa <nestorvilla@patitasco.com>, Manolo Corte <manolocorte@patitasco.com>
6
+ License: MIT License
7
+
8
+ Copyright (c) 2025 Patitas and Co
9
+
10
+ Permission is hereby granted, free of charge, to any person obtaining a copy
11
+ of this software and associated documentation files (the "Software"), to deal
12
+ in the Software without restriction, including without limitation the rights
13
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
14
+ copies of the Software, and to permit persons to whom the Software is
15
+ furnished to do so, subject to the following conditions:
16
+
17
+ The above copyright notice and this permission notice shall be included in all
18
+ copies or substantial portions of the Software.
19
+
20
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
21
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
22
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
23
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
24
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
25
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
26
+ SOFTWARE.
27
+
28
+ Project-URL: Documentation, https://github.com/patitas-and-co/prestashop-webservice/blob/main/README.md
29
+ Project-URL: Repository, https://github.com/patitas-and-co/prestashop-webservice
30
+ Keywords: prestashop,api,client,webservice,rest
31
+ Requires-Python: >=3.12
32
+ Description-Content-Type: text/markdown
33
+ License-File: LICENSE
34
+ Requires-Dist: httpx
35
+ Requires-Dist: cachetools
36
+ Requires-Dist: loguru
37
+ Requires-Dist: pre-commit
38
+ Provides-Extra: dev
39
+ Requires-Dist: pytest; extra == "dev"
40
+ Requires-Dist: pytest-cov; extra == "dev"
41
+ Requires-Dist: python-dotenv; extra == "dev"
42
+ Requires-Dist: ruff; extra == "dev"
43
+ Dynamic: license-file
44
+
45
+ # PrestaShop Webservice
46
+
47
+ Python client for PrestaShop API with caching, logging, and type hints.
48
+
49
+ ## Installation
50
+
51
+ ```bash
52
+ pip install prestashop-webservice
53
+ ```
54
+
55
+ ## Quick Start
56
+
57
+ ```python
58
+ from prestashop_webservice import Client, Params, Sort, SortOrder
59
+
60
+ # Initialize client
61
+ client = Client(
62
+ prestashop_base_url="https://your-store.com/api",
63
+ prestashop_ws_key="YOUR_API_KEY"
64
+ )
65
+
66
+ # Simple queries
67
+ order = client.query_order(order_id="123")
68
+ customer = client.query_customer(customer_id="456")
69
+
70
+ # Advanced queries with parameters
71
+ params = Params(
72
+ filter={"id_customer": "123"},
73
+ sort=Sort(field="date_add", order=SortOrder.DESC),
74
+ display=["id", "total_paid", "reference"],
75
+ limit=10
76
+ )
77
+ orders = client.query_orders(params=params)
78
+ ```
79
+
80
+ ## Features
81
+
82
+ - 🚀 HTTP client with connection pooling
83
+ - 💾 Automatic caching (24h TTL)
84
+ - 📝 Logging with Loguru
85
+ - 🎯 Full type hints
86
+ - 🔒 Singleton pattern
87
+
88
+ ## Available Methods
89
+
90
+ - `query_order()`, `query_orders()`, `exists_order()`
91
+ - `query_customer()`, `query_customers()`
92
+ - `query_product()`, `query_address()`, `query_country()`
93
+ - `query_order_carriers()`, `query_order_histories()`, `query_order_state()`
94
+
95
+ ## License
96
+
97
+ MIT License - See [LICENSE](LICENSE) file for details.
@@ -0,0 +1,53 @@
1
+ # PrestaShop Webservice
2
+
3
+ Python client for PrestaShop API with caching, logging, and type hints.
4
+
5
+ ## Installation
6
+
7
+ ```bash
8
+ pip install prestashop-webservice
9
+ ```
10
+
11
+ ## Quick Start
12
+
13
+ ```python
14
+ from prestashop_webservice import Client, Params, Sort, SortOrder
15
+
16
+ # Initialize client
17
+ client = Client(
18
+ prestashop_base_url="https://your-store.com/api",
19
+ prestashop_ws_key="YOUR_API_KEY"
20
+ )
21
+
22
+ # Simple queries
23
+ order = client.query_order(order_id="123")
24
+ customer = client.query_customer(customer_id="456")
25
+
26
+ # Advanced queries with parameters
27
+ params = Params(
28
+ filter={"id_customer": "123"},
29
+ sort=Sort(field="date_add", order=SortOrder.DESC),
30
+ display=["id", "total_paid", "reference"],
31
+ limit=10
32
+ )
33
+ orders = client.query_orders(params=params)
34
+ ```
35
+
36
+ ## Features
37
+
38
+ - 🚀 HTTP client with connection pooling
39
+ - 💾 Automatic caching (24h TTL)
40
+ - 📝 Logging with Loguru
41
+ - 🎯 Full type hints
42
+ - 🔒 Singleton pattern
43
+
44
+ ## Available Methods
45
+
46
+ - `query_order()`, `query_orders()`, `exists_order()`
47
+ - `query_customer()`, `query_customers()`
48
+ - `query_product()`, `query_address()`, `query_country()`
49
+ - `query_order_carriers()`, `query_order_histories()`, `query_order_state()`
50
+
51
+ ## License
52
+
53
+ MIT License - See [LICENSE](LICENSE) file for details.
@@ -0,0 +1,93 @@
1
+ # Installation
2
+
3
+ ## Installation Methods
4
+
5
+ ### 1. Direct installation from Git (Recommended for internal use)
6
+
7
+ ```bash
8
+ pip install git+https://github.com/yourcompany/prestashop-webservice.git
9
+ ```
10
+
11
+ ### 2. Installation from Git with specific version
12
+
13
+ ```bash
14
+ pip install git+https://github.com/yourcompany/prestashop-webservice.git@v0.1.0
15
+ ```
16
+
17
+ ### 3. Installation in development mode
18
+
19
+ ```bash
20
+ git clone https://github.com/yourcompany/prestashop-webservice.git
21
+ cd prestashop-webservice
22
+ pip install -e .
23
+ ```
24
+
25
+ ### 4. Installation with development dependencies
26
+
27
+ ```bash
28
+ pip install -e ".[dev]"
29
+ ```
30
+
31
+ ### 5. Using requirements.txt
32
+
33
+ Add to your `requirements.txt`:
34
+
35
+ ```
36
+ git+https://github.com/yourcompany/prestashop-webservice.git@v0.1.0
37
+ ```
38
+
39
+ Then install:
40
+
41
+ ```bash
42
+ pip install -r requirements.txt
43
+ ```
44
+
45
+ ### 6. Using as Git submodule
46
+
47
+ ```bash
48
+ # Add as submodule
49
+ git submodule add https://github.com/yourcompany/prestashop-webservice.git libs/prestashop-webservice
50
+
51
+ # Install
52
+ pip install -e libs/prestashop-webservice
53
+ ```
54
+
55
+ ## Verify installation
56
+
57
+ ```python
58
+ import prestashop_webservice
59
+ print(prestashop_webservice.__version__)
60
+ ```
61
+
62
+ ## Requirements
63
+
64
+ - Python >= 3.10
65
+ - httpx >= 0.25.0
66
+ - cachetools >= 5.3.0
67
+ - loguru >= 0.7.0
68
+
69
+ ## Troubleshooting
70
+
71
+ ### Error: No module named 'prestashop_webservice'
72
+
73
+ Make sure you have installed the package correctly:
74
+
75
+ ```bash
76
+ pip list | grep prestashop
77
+ ```
78
+
79
+ ### Permission errors
80
+
81
+ On some systems you will need to use `sudo` or install in a virtual environment:
82
+
83
+ ```bash
84
+ python -m venv venv
85
+ source venv/bin/activate # On Windows: venv\Scripts\activate
86
+ pip install git+https://github.com/yourcompany/prestashop-webservice.git
87
+ ```
88
+
89
+ ### Update to latest version
90
+
91
+ ```bash
92
+ pip install --upgrade git+https://github.com/yourcompany/prestashop-webservice.git
93
+ ```