falabella-sdk 1.0.0a1__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.
- falabella_sdk-1.0.0a1/LICENSE +21 -0
- falabella_sdk-1.0.0a1/PKG-INFO +210 -0
- falabella_sdk-1.0.0a1/README.md +180 -0
- falabella_sdk-1.0.0a1/pyproject.toml +57 -0
- falabella_sdk-1.0.0a1/setup.cfg +4 -0
- falabella_sdk-1.0.0a1/src/falabella_sdk/__init__.py +17 -0
- falabella_sdk-1.0.0a1/src/falabella_sdk/actions.py +32 -0
- falabella_sdk-1.0.0a1/src/falabella_sdk/client.py +394 -0
- falabella_sdk-1.0.0a1/src/falabella_sdk/orders.py +240 -0
- falabella_sdk-1.0.0a1/src/falabella_sdk/products.py +124 -0
- falabella_sdk-1.0.0a1/src/falabella_sdk/seller.py +30 -0
- falabella_sdk-1.0.0a1/src/falabella_sdk/shipments.py +56 -0
- falabella_sdk-1.0.0a1/src/falabella_sdk.egg-info/PKG-INFO +210 -0
- falabella_sdk-1.0.0a1/src/falabella_sdk.egg-info/SOURCES.txt +26 -0
- falabella_sdk-1.0.0a1/src/falabella_sdk.egg-info/dependency_links.txt +1 -0
- falabella_sdk-1.0.0a1/src/falabella_sdk.egg-info/requires.txt +7 -0
- falabella_sdk-1.0.0a1/src/falabella_sdk.egg-info/top_level.txt +1 -0
- falabella_sdk-1.0.0a1/tests/test_client_init.py +33 -0
- falabella_sdk-1.0.0a1/tests/test_legacy_shim.py +39 -0
- falabella_sdk-1.0.0a1/tests/test_orders.py +152 -0
- falabella_sdk-1.0.0a1/tests/test_package.py +30 -0
- falabella_sdk-1.0.0a1/tests/test_products.py +101 -0
- falabella_sdk-1.0.0a1/tests/test_query.py +165 -0
- falabella_sdk-1.0.0a1/tests/test_seller.py +15 -0
- falabella_sdk-1.0.0a1/tests/test_shipments.py +39 -0
- falabella_sdk-1.0.0a1/tests/test_signature.py +110 -0
- falabella_sdk-1.0.0a1/tests/test_transport.py +319 -0
- falabella_sdk-1.0.0a1/tests/test_user_agent.py +120 -0
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2023 Camilo Andrés Rodríguez
|
|
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,210 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: falabella-sdk
|
|
3
|
+
Version: 1.0.0a1
|
|
4
|
+
Summary: Unofficial Python SDK for the Falabella Seller Center API
|
|
5
|
+
Author-email: Camilo Andrés Rodríguez Higuera <andres.roh@outlook.com>
|
|
6
|
+
License: MIT
|
|
7
|
+
Project-URL: Homepage, https://github.com/camilordz1/FalabellaAPIClient
|
|
8
|
+
Project-URL: Source, https://github.com/camilordz1/FalabellaAPIClient
|
|
9
|
+
Project-URL: Issues, https://github.com/camilordz1/FalabellaAPIClient/issues
|
|
10
|
+
Keywords: python,falabella,seller center,api client
|
|
11
|
+
Classifier: Development Status :: 3 - Alpha
|
|
12
|
+
Classifier: Intended Audience :: Developers
|
|
13
|
+
Classifier: Topic :: Software Development :: Libraries :: Python Modules
|
|
14
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
15
|
+
Classifier: Programming Language :: Python :: 3
|
|
16
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
17
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
18
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
19
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
20
|
+
Requires-Python: >=3.10
|
|
21
|
+
Description-Content-Type: text/markdown
|
|
22
|
+
License-File: LICENSE
|
|
23
|
+
Requires-Dist: requests>=2.31
|
|
24
|
+
Provides-Extra: dev
|
|
25
|
+
Requires-Dist: pytest>=8.0; extra == "dev"
|
|
26
|
+
Requires-Dist: responses>=0.25; extra == "dev"
|
|
27
|
+
Requires-Dist: freezegun>=1.4; extra == "dev"
|
|
28
|
+
Requires-Dist: ruff>=0.6; extra == "dev"
|
|
29
|
+
Dynamic: license-file
|
|
30
|
+
|
|
31
|
+
# falabella-sdk
|
|
32
|
+
|
|
33
|
+
[](https://github.com/camilordz1/FalabellaAPIClient/actions/workflows/ci.yml)
|
|
34
|
+
|
|
35
|
+
**SDK no oficial** de Python para la API de Falabella Seller Center. Este proyecto no está afiliado ni respaldado por Falabella.
|
|
36
|
+
|
|
37
|
+
Este módulo permite interactuar de manera sencilla y eficiente con la API de Falabella Seller Center para administrar productos, categorías, órdenes, despachos y datos del vendedor. El cliente utiliza una arquitectura basada en composición y propiedades perezosas (lazy properties) para ofrecer una interfaz unificada y moderna. La versión anterior y el soporte de Linio se eliminaron; consulta la sección **Cambios incompatibles** para migrar.
|
|
38
|
+
|
|
39
|
+
---
|
|
40
|
+
|
|
41
|
+
## Instalación
|
|
42
|
+
|
|
43
|
+
```bash
|
|
44
|
+
pip install falabella-sdk
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
Requiere Python 3.10+.
|
|
48
|
+
|
|
49
|
+
---
|
|
50
|
+
|
|
51
|
+
## Uso básico
|
|
52
|
+
|
|
53
|
+
La arquitectura actual utiliza un único cliente (`FalabellaClient`) que gestiona internamente la sesión HTTP y la generación de firmas `HMAC-SHA256`. Los recursos se cargan dinámicamente como propiedades del cliente.
|
|
54
|
+
|
|
55
|
+
```python
|
|
56
|
+
import json
|
|
57
|
+
from falabella_sdk import FalabellaClient, FalabellaAPIError
|
|
58
|
+
|
|
59
|
+
# Inicializar el cliente unificado
|
|
60
|
+
client = FalabellaClient(
|
|
61
|
+
user="email@example.com",
|
|
62
|
+
key="_api_key_",
|
|
63
|
+
seller_id="ABC123", # seller id que aparece en Seller Center en "Mi cuenta"
|
|
64
|
+
business_unit="FACO", # "FACL" (Chile), "FACO" (Colombia), "FAPE" (Perú)
|
|
65
|
+
integration_type="PROPIA", # nombre del integrador si no eres el vendedor
|
|
66
|
+
)
|
|
67
|
+
|
|
68
|
+
# 1. Obtener información de un producto
|
|
69
|
+
try:
|
|
70
|
+
product_list = ["TP-19150"]
|
|
71
|
+
item = client.products.get(SkuSellerList=json.dumps(product_list))
|
|
72
|
+
print("Producto obtenido:", item)
|
|
73
|
+
except FalabellaAPIError as e:
|
|
74
|
+
print(f"Error al obtener el producto: {e.message} (Status: {e.status_code})")
|
|
75
|
+
|
|
76
|
+
# 2. Consultar órdenes
|
|
77
|
+
try:
|
|
78
|
+
orders_list = client.orders.list(Limit=10)
|
|
79
|
+
print("Últimas 10 órdenes:", orders_list)
|
|
80
|
+
|
|
81
|
+
# Obtener ítems de una orden específica
|
|
82
|
+
order_items = client.orders.items(order_id=100513)
|
|
83
|
+
print("Ítems de la orden 100513:", order_items)
|
|
84
|
+
except FalabellaAPIError as e:
|
|
85
|
+
print(f"Error con las órdenes: {e}")
|
|
86
|
+
```
|
|
87
|
+
|
|
88
|
+
Falabella exige enviar un encabezado `User-Agent` con el formato
|
|
89
|
+
`SELLER_ID/TECHNOLOGY/TECHNOLOGY_VERSION/INTEGRATION_TYPE/BUSINESS_UNIT_CODE`
|
|
90
|
+
(por ejemplo, `ABC123/Python/3.12.1/PROPIA/FACO`). El cliente lo construye a partir de `seller_id`,
|
|
91
|
+
`integration_type` y `business_unit`; el seller id aparece en Seller Center en "Mi cuenta".
|
|
92
|
+
`seller_id` es opcional por ahora: si falta, el cliente emite un `UserWarning` y no envía el
|
|
93
|
+
`User-Agent` de Falabella. Será obligatorio en la próxima versión mayor.
|
|
94
|
+
|
|
95
|
+
---
|
|
96
|
+
|
|
97
|
+
## Tiempos de espera y reintentos
|
|
98
|
+
|
|
99
|
+
`FalabellaClient` acepta las siguientes opciones de transporte como argumentos de solo palabra clave:
|
|
100
|
+
|
|
101
|
+
```python
|
|
102
|
+
client = FalabellaClient(
|
|
103
|
+
user="email@example.com",
|
|
104
|
+
key="_api_key_",
|
|
105
|
+
timeout=30.0, # segundos por petición
|
|
106
|
+
max_retries=3, # reintentos después del primer intento
|
|
107
|
+
backoff_factor=1.0, # base del backoff exponencial
|
|
108
|
+
)
|
|
109
|
+
```
|
|
110
|
+
|
|
111
|
+
Las peticiones que no fueron procesadas se reintentan hasta `1 + max_retries` veces. Los tiempos de
|
|
112
|
+
espera usan el encabezado `Retry-After` cuando es numérico; de lo contrario, aplican
|
|
113
|
+
`backoff_factor * 2 ** (attempt - 1)`, con un máximo de 60 segundos.
|
|
114
|
+
|
|
115
|
+
| Condición | GET | POST (escrituras) |
|
|
116
|
+
|---|---|---|
|
|
117
|
+
| HTTP 429 | reintentar | reintentar |
|
|
118
|
+
| `ErrorResponse` con `ErrorCode` `429` | reintentar | reintentar |
|
|
119
|
+
| HTTP 5xx | reintentar | no reintentar |
|
|
120
|
+
| `ConnectionError` / `Timeout` | reintentar | no reintentar |
|
|
121
|
+
| Cualquier otro error | no reintentar | no reintentar |
|
|
122
|
+
|
|
123
|
+
`payload` debe ser `None`, `str` o `bytes` (XML); otros tipos lanzan `TypeError` antes de enviar la
|
|
124
|
+
petición.
|
|
125
|
+
|
|
126
|
+
---
|
|
127
|
+
|
|
128
|
+
## Recursos disponibles
|
|
129
|
+
|
|
130
|
+
El cliente `FalabellaClient` expone los siguientes recursos mediante propiedades perezosas:
|
|
131
|
+
|
|
132
|
+
### 1. `client.products` (Productos y Categorías)
|
|
133
|
+
* `get(limit=1000, **kwargs)`: Obtiene información de productos utilizando el filtro `GetProducts`.
|
|
134
|
+
* `create(payload)`: Crea nuevos productos enviando una estructura XML.
|
|
135
|
+
* `update(payload)`: Actualiza productos existentes (estructura XML).
|
|
136
|
+
* `remove(payload)`: Elimina productos de la plataforma.
|
|
137
|
+
* `brands()`: Obtiene la lista de marcas asociadas del vendedor (`GetBrands`).
|
|
138
|
+
* `get_category_tree()`: Recupera la jerarquía completa de categorías de la plataforma.
|
|
139
|
+
* `get_category_attributes(primary_category_id)`: Retorna la lista de atributos y campos requeridos para una categoría específica.
|
|
140
|
+
|
|
141
|
+
### 2. `client.orders` (Órdenes de Venta)
|
|
142
|
+
* `list(**kwargs)`: Obtiene la lista de órdenes (`GetOrders`).
|
|
143
|
+
* `get(order_id, **kwargs)`: Obtiene detalles de una orden específica.
|
|
144
|
+
* `items(order_id, template="JSON")`: Obtiene los ítems individuales de una orden.
|
|
145
|
+
* `multiple_order_items(order_id_list, template="JSON")`: Obtiene ítems de una lista de órdenes.
|
|
146
|
+
* **Transiciones de Estado de Despacho (Lifecycle):**
|
|
147
|
+
* `set_status_to_packed_by_marketplace(order_item_ids, shipping_provider, delivery_type)`
|
|
148
|
+
* `set_status_to_ready_to_ship(order_item_ids, shipping_provider, tracking_number, delivery_type)`
|
|
149
|
+
* `set_status_to_shipped(order_item_ids, tracking_number)`
|
|
150
|
+
* `set_status_to_delivered(order_item_ids)`
|
|
151
|
+
* `set_status_to_failed(order_item_ids, reason, reason_detail=None)`
|
|
152
|
+
* `set_status_to_cancelled(order_item_ids, reason, reason_detail=None)`
|
|
153
|
+
|
|
154
|
+
### 3. `client.seller` (Perfil del Vendedor)
|
|
155
|
+
* `get()`: Obtiene el perfil de vendedor y el estado general de la cuenta (`GetSeller`).
|
|
156
|
+
|
|
157
|
+
### 4. `client.shipments` (Envíos y Documentación)
|
|
158
|
+
* `get_providers()`: Obtiene el listado de transportistas disponibles (`GetShipmentProviders`).
|
|
159
|
+
* `get_document(order_item_ids, document_type="shippingLabel")`: Descarga documentos en HTML/PDF como guías de despacho (`shippingLabel`), facturas (`invoice`) o manifiestos (`carrierManifest`).
|
|
160
|
+
|
|
161
|
+
---
|
|
162
|
+
|
|
163
|
+
## Cambios incompatibles
|
|
164
|
+
|
|
165
|
+
- Python 3.9 ya no es compatible; la versión mínima es Python 3.10.
|
|
166
|
+
- El paquete se renombró de `FalabellaAPIClient` a `falabella-sdk` (importación `falabella_sdk`).
|
|
167
|
+
|
|
168
|
+
```python
|
|
169
|
+
# Antes
|
|
170
|
+
from FalabellaAPIClient import FalabellaClient
|
|
171
|
+
|
|
172
|
+
# Después
|
|
173
|
+
from falabella_sdk import FalabellaClient
|
|
174
|
+
```
|
|
175
|
+
|
|
176
|
+
- Se eliminó el soporte de Linio; el cliente siempre apunta a `https://sellercenter-api.falabella.com`.
|
|
177
|
+
- Se eliminaron los parámetros `service` y `country` del constructor.
|
|
178
|
+
- Se eliminaron las clases heredadas `Session` y `Service`. Usa `FalabellaClient` y sus propiedades
|
|
179
|
+
de recursos (`client.products`, `client.orders`, `client.seller`, `client.shipments`) en su lugar.
|
|
180
|
+
|
|
181
|
+
```python
|
|
182
|
+
# Antes
|
|
183
|
+
session = Session(user, key, "falabella")
|
|
184
|
+
service = Service()
|
|
185
|
+
items = Products(service, session)
|
|
186
|
+
|
|
187
|
+
# Después
|
|
188
|
+
from falabella_sdk import FalabellaClient
|
|
189
|
+
|
|
190
|
+
client = FalabellaClient(user=user, key=key, seller_id="ABC123")
|
|
191
|
+
items = client.products
|
|
192
|
+
```
|
|
193
|
+
|
|
194
|
+
Consulta `examples/basic_usage.py` para ver un script completo controlado por variables de entorno.
|
|
195
|
+
|
|
196
|
+
---
|
|
197
|
+
|
|
198
|
+
## Desarrollo
|
|
199
|
+
|
|
200
|
+
```bash
|
|
201
|
+
python -m venv .venv
|
|
202
|
+
source .venv/bin/activate
|
|
203
|
+
pip install -e ".[dev]"
|
|
204
|
+
pytest
|
|
205
|
+
ruff check .
|
|
206
|
+
```
|
|
207
|
+
|
|
208
|
+
## Licencia
|
|
209
|
+
|
|
210
|
+
Este proyecto se encuentra bajo la Licencia [MIT](LICENSE).
|
|
@@ -0,0 +1,180 @@
|
|
|
1
|
+
# falabella-sdk
|
|
2
|
+
|
|
3
|
+
[](https://github.com/camilordz1/FalabellaAPIClient/actions/workflows/ci.yml)
|
|
4
|
+
|
|
5
|
+
**SDK no oficial** de Python para la API de Falabella Seller Center. Este proyecto no está afiliado ni respaldado por Falabella.
|
|
6
|
+
|
|
7
|
+
Este módulo permite interactuar de manera sencilla y eficiente con la API de Falabella Seller Center para administrar productos, categorías, órdenes, despachos y datos del vendedor. El cliente utiliza una arquitectura basada en composición y propiedades perezosas (lazy properties) para ofrecer una interfaz unificada y moderna. La versión anterior y el soporte de Linio se eliminaron; consulta la sección **Cambios incompatibles** para migrar.
|
|
8
|
+
|
|
9
|
+
---
|
|
10
|
+
|
|
11
|
+
## Instalación
|
|
12
|
+
|
|
13
|
+
```bash
|
|
14
|
+
pip install falabella-sdk
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
Requiere Python 3.10+.
|
|
18
|
+
|
|
19
|
+
---
|
|
20
|
+
|
|
21
|
+
## Uso básico
|
|
22
|
+
|
|
23
|
+
La arquitectura actual utiliza un único cliente (`FalabellaClient`) que gestiona internamente la sesión HTTP y la generación de firmas `HMAC-SHA256`. Los recursos se cargan dinámicamente como propiedades del cliente.
|
|
24
|
+
|
|
25
|
+
```python
|
|
26
|
+
import json
|
|
27
|
+
from falabella_sdk import FalabellaClient, FalabellaAPIError
|
|
28
|
+
|
|
29
|
+
# Inicializar el cliente unificado
|
|
30
|
+
client = FalabellaClient(
|
|
31
|
+
user="email@example.com",
|
|
32
|
+
key="_api_key_",
|
|
33
|
+
seller_id="ABC123", # seller id que aparece en Seller Center en "Mi cuenta"
|
|
34
|
+
business_unit="FACO", # "FACL" (Chile), "FACO" (Colombia), "FAPE" (Perú)
|
|
35
|
+
integration_type="PROPIA", # nombre del integrador si no eres el vendedor
|
|
36
|
+
)
|
|
37
|
+
|
|
38
|
+
# 1. Obtener información de un producto
|
|
39
|
+
try:
|
|
40
|
+
product_list = ["TP-19150"]
|
|
41
|
+
item = client.products.get(SkuSellerList=json.dumps(product_list))
|
|
42
|
+
print("Producto obtenido:", item)
|
|
43
|
+
except FalabellaAPIError as e:
|
|
44
|
+
print(f"Error al obtener el producto: {e.message} (Status: {e.status_code})")
|
|
45
|
+
|
|
46
|
+
# 2. Consultar órdenes
|
|
47
|
+
try:
|
|
48
|
+
orders_list = client.orders.list(Limit=10)
|
|
49
|
+
print("Últimas 10 órdenes:", orders_list)
|
|
50
|
+
|
|
51
|
+
# Obtener ítems de una orden específica
|
|
52
|
+
order_items = client.orders.items(order_id=100513)
|
|
53
|
+
print("Ítems de la orden 100513:", order_items)
|
|
54
|
+
except FalabellaAPIError as e:
|
|
55
|
+
print(f"Error con las órdenes: {e}")
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
Falabella exige enviar un encabezado `User-Agent` con el formato
|
|
59
|
+
`SELLER_ID/TECHNOLOGY/TECHNOLOGY_VERSION/INTEGRATION_TYPE/BUSINESS_UNIT_CODE`
|
|
60
|
+
(por ejemplo, `ABC123/Python/3.12.1/PROPIA/FACO`). El cliente lo construye a partir de `seller_id`,
|
|
61
|
+
`integration_type` y `business_unit`; el seller id aparece en Seller Center en "Mi cuenta".
|
|
62
|
+
`seller_id` es opcional por ahora: si falta, el cliente emite un `UserWarning` y no envía el
|
|
63
|
+
`User-Agent` de Falabella. Será obligatorio en la próxima versión mayor.
|
|
64
|
+
|
|
65
|
+
---
|
|
66
|
+
|
|
67
|
+
## Tiempos de espera y reintentos
|
|
68
|
+
|
|
69
|
+
`FalabellaClient` acepta las siguientes opciones de transporte como argumentos de solo palabra clave:
|
|
70
|
+
|
|
71
|
+
```python
|
|
72
|
+
client = FalabellaClient(
|
|
73
|
+
user="email@example.com",
|
|
74
|
+
key="_api_key_",
|
|
75
|
+
timeout=30.0, # segundos por petición
|
|
76
|
+
max_retries=3, # reintentos después del primer intento
|
|
77
|
+
backoff_factor=1.0, # base del backoff exponencial
|
|
78
|
+
)
|
|
79
|
+
```
|
|
80
|
+
|
|
81
|
+
Las peticiones que no fueron procesadas se reintentan hasta `1 + max_retries` veces. Los tiempos de
|
|
82
|
+
espera usan el encabezado `Retry-After` cuando es numérico; de lo contrario, aplican
|
|
83
|
+
`backoff_factor * 2 ** (attempt - 1)`, con un máximo de 60 segundos.
|
|
84
|
+
|
|
85
|
+
| Condición | GET | POST (escrituras) |
|
|
86
|
+
|---|---|---|
|
|
87
|
+
| HTTP 429 | reintentar | reintentar |
|
|
88
|
+
| `ErrorResponse` con `ErrorCode` `429` | reintentar | reintentar |
|
|
89
|
+
| HTTP 5xx | reintentar | no reintentar |
|
|
90
|
+
| `ConnectionError` / `Timeout` | reintentar | no reintentar |
|
|
91
|
+
| Cualquier otro error | no reintentar | no reintentar |
|
|
92
|
+
|
|
93
|
+
`payload` debe ser `None`, `str` o `bytes` (XML); otros tipos lanzan `TypeError` antes de enviar la
|
|
94
|
+
petición.
|
|
95
|
+
|
|
96
|
+
---
|
|
97
|
+
|
|
98
|
+
## Recursos disponibles
|
|
99
|
+
|
|
100
|
+
El cliente `FalabellaClient` expone los siguientes recursos mediante propiedades perezosas:
|
|
101
|
+
|
|
102
|
+
### 1. `client.products` (Productos y Categorías)
|
|
103
|
+
* `get(limit=1000, **kwargs)`: Obtiene información de productos utilizando el filtro `GetProducts`.
|
|
104
|
+
* `create(payload)`: Crea nuevos productos enviando una estructura XML.
|
|
105
|
+
* `update(payload)`: Actualiza productos existentes (estructura XML).
|
|
106
|
+
* `remove(payload)`: Elimina productos de la plataforma.
|
|
107
|
+
* `brands()`: Obtiene la lista de marcas asociadas del vendedor (`GetBrands`).
|
|
108
|
+
* `get_category_tree()`: Recupera la jerarquía completa de categorías de la plataforma.
|
|
109
|
+
* `get_category_attributes(primary_category_id)`: Retorna la lista de atributos y campos requeridos para una categoría específica.
|
|
110
|
+
|
|
111
|
+
### 2. `client.orders` (Órdenes de Venta)
|
|
112
|
+
* `list(**kwargs)`: Obtiene la lista de órdenes (`GetOrders`).
|
|
113
|
+
* `get(order_id, **kwargs)`: Obtiene detalles de una orden específica.
|
|
114
|
+
* `items(order_id, template="JSON")`: Obtiene los ítems individuales de una orden.
|
|
115
|
+
* `multiple_order_items(order_id_list, template="JSON")`: Obtiene ítems de una lista de órdenes.
|
|
116
|
+
* **Transiciones de Estado de Despacho (Lifecycle):**
|
|
117
|
+
* `set_status_to_packed_by_marketplace(order_item_ids, shipping_provider, delivery_type)`
|
|
118
|
+
* `set_status_to_ready_to_ship(order_item_ids, shipping_provider, tracking_number, delivery_type)`
|
|
119
|
+
* `set_status_to_shipped(order_item_ids, tracking_number)`
|
|
120
|
+
* `set_status_to_delivered(order_item_ids)`
|
|
121
|
+
* `set_status_to_failed(order_item_ids, reason, reason_detail=None)`
|
|
122
|
+
* `set_status_to_cancelled(order_item_ids, reason, reason_detail=None)`
|
|
123
|
+
|
|
124
|
+
### 3. `client.seller` (Perfil del Vendedor)
|
|
125
|
+
* `get()`: Obtiene el perfil de vendedor y el estado general de la cuenta (`GetSeller`).
|
|
126
|
+
|
|
127
|
+
### 4. `client.shipments` (Envíos y Documentación)
|
|
128
|
+
* `get_providers()`: Obtiene el listado de transportistas disponibles (`GetShipmentProviders`).
|
|
129
|
+
* `get_document(order_item_ids, document_type="shippingLabel")`: Descarga documentos en HTML/PDF como guías de despacho (`shippingLabel`), facturas (`invoice`) o manifiestos (`carrierManifest`).
|
|
130
|
+
|
|
131
|
+
---
|
|
132
|
+
|
|
133
|
+
## Cambios incompatibles
|
|
134
|
+
|
|
135
|
+
- Python 3.9 ya no es compatible; la versión mínima es Python 3.10.
|
|
136
|
+
- El paquete se renombró de `FalabellaAPIClient` a `falabella-sdk` (importación `falabella_sdk`).
|
|
137
|
+
|
|
138
|
+
```python
|
|
139
|
+
# Antes
|
|
140
|
+
from FalabellaAPIClient import FalabellaClient
|
|
141
|
+
|
|
142
|
+
# Después
|
|
143
|
+
from falabella_sdk import FalabellaClient
|
|
144
|
+
```
|
|
145
|
+
|
|
146
|
+
- Se eliminó el soporte de Linio; el cliente siempre apunta a `https://sellercenter-api.falabella.com`.
|
|
147
|
+
- Se eliminaron los parámetros `service` y `country` del constructor.
|
|
148
|
+
- Se eliminaron las clases heredadas `Session` y `Service`. Usa `FalabellaClient` y sus propiedades
|
|
149
|
+
de recursos (`client.products`, `client.orders`, `client.seller`, `client.shipments`) en su lugar.
|
|
150
|
+
|
|
151
|
+
```python
|
|
152
|
+
# Antes
|
|
153
|
+
session = Session(user, key, "falabella")
|
|
154
|
+
service = Service()
|
|
155
|
+
items = Products(service, session)
|
|
156
|
+
|
|
157
|
+
# Después
|
|
158
|
+
from falabella_sdk import FalabellaClient
|
|
159
|
+
|
|
160
|
+
client = FalabellaClient(user=user, key=key, seller_id="ABC123")
|
|
161
|
+
items = client.products
|
|
162
|
+
```
|
|
163
|
+
|
|
164
|
+
Consulta `examples/basic_usage.py` para ver un script completo controlado por variables de entorno.
|
|
165
|
+
|
|
166
|
+
---
|
|
167
|
+
|
|
168
|
+
## Desarrollo
|
|
169
|
+
|
|
170
|
+
```bash
|
|
171
|
+
python -m venv .venv
|
|
172
|
+
source .venv/bin/activate
|
|
173
|
+
pip install -e ".[dev]"
|
|
174
|
+
pytest
|
|
175
|
+
ruff check .
|
|
176
|
+
```
|
|
177
|
+
|
|
178
|
+
## Licencia
|
|
179
|
+
|
|
180
|
+
Este proyecto se encuentra bajo la Licencia [MIT](LICENSE).
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
[build-system]
|
|
2
|
+
requires = ["setuptools>=69"]
|
|
3
|
+
build-backend = "setuptools.build_meta"
|
|
4
|
+
|
|
5
|
+
[project]
|
|
6
|
+
name = "falabella-sdk"
|
|
7
|
+
dynamic = ["version"]
|
|
8
|
+
description = "Unofficial Python SDK for the Falabella Seller Center API"
|
|
9
|
+
readme = "README.md"
|
|
10
|
+
requires-python = ">=3.10"
|
|
11
|
+
license = {text = "MIT"}
|
|
12
|
+
authors = [
|
|
13
|
+
{name = "Camilo Andrés Rodríguez Higuera", email = "andres.roh@outlook.com"},
|
|
14
|
+
]
|
|
15
|
+
dependencies = ["requests>=2.31"]
|
|
16
|
+
keywords = ["python", "falabella", "seller center", "api client"]
|
|
17
|
+
classifiers = [
|
|
18
|
+
"Development Status :: 3 - Alpha",
|
|
19
|
+
"Intended Audience :: Developers",
|
|
20
|
+
"Topic :: Software Development :: Libraries :: Python Modules",
|
|
21
|
+
"License :: OSI Approved :: MIT License",
|
|
22
|
+
"Programming Language :: Python :: 3",
|
|
23
|
+
"Programming Language :: Python :: 3.10",
|
|
24
|
+
"Programming Language :: Python :: 3.11",
|
|
25
|
+
"Programming Language :: Python :: 3.12",
|
|
26
|
+
"Programming Language :: Python :: 3.13",
|
|
27
|
+
]
|
|
28
|
+
|
|
29
|
+
[project.optional-dependencies]
|
|
30
|
+
dev = ["pytest>=8.0", "responses>=0.25", "freezegun>=1.4", "ruff>=0.6"]
|
|
31
|
+
|
|
32
|
+
[project.urls]
|
|
33
|
+
Homepage = "https://github.com/camilordz1/FalabellaAPIClient"
|
|
34
|
+
Source = "https://github.com/camilordz1/FalabellaAPIClient"
|
|
35
|
+
Issues = "https://github.com/camilordz1/FalabellaAPIClient/issues"
|
|
36
|
+
|
|
37
|
+
[tool.setuptools.dynamic]
|
|
38
|
+
version = {attr = "falabella_sdk.__version__"}
|
|
39
|
+
|
|
40
|
+
[tool.setuptools.packages.find]
|
|
41
|
+
where = ["src"]
|
|
42
|
+
|
|
43
|
+
[tool.pytest.ini_options]
|
|
44
|
+
testpaths = ["tests"]
|
|
45
|
+
pythonpath = ["src"]
|
|
46
|
+
|
|
47
|
+
[tool.ruff]
|
|
48
|
+
target-version = "py310"
|
|
49
|
+
line-length = 100
|
|
50
|
+
src = ["src", "tests"]
|
|
51
|
+
|
|
52
|
+
[tool.ruff.lint]
|
|
53
|
+
select = ["E", "F", "W", "I"]
|
|
54
|
+
|
|
55
|
+
[tool.ruff.lint.per-file-ignores]
|
|
56
|
+
"tests/*" = ["E501"]
|
|
57
|
+
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
from falabella_sdk.client import FalabellaAPIError, FalabellaClient
|
|
2
|
+
from falabella_sdk.orders import Orders
|
|
3
|
+
from falabella_sdk.products import Products
|
|
4
|
+
from falabella_sdk.seller import Seller
|
|
5
|
+
from falabella_sdk.shipments import Shipments
|
|
6
|
+
|
|
7
|
+
__version__ = "1.0.0a1"
|
|
8
|
+
|
|
9
|
+
__all__ = [
|
|
10
|
+
"FalabellaClient",
|
|
11
|
+
"FalabellaAPIError",
|
|
12
|
+
"Products",
|
|
13
|
+
"Orders",
|
|
14
|
+
"Seller",
|
|
15
|
+
"Shipments",
|
|
16
|
+
"__version__",
|
|
17
|
+
]
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
from typing import TYPE_CHECKING, Optional
|
|
2
|
+
|
|
3
|
+
if TYPE_CHECKING:
|
|
4
|
+
from falabella_sdk.client import FalabellaClient
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
class Actions:
|
|
8
|
+
"""Clase base para todos los recursos de la API de Falabella Seller Center."""
|
|
9
|
+
|
|
10
|
+
def __init__(self, client: Optional['FalabellaClient'] = None) -> None:
|
|
11
|
+
"""Inicializa el recurso con una referencia al cliente unificado.
|
|
12
|
+
|
|
13
|
+
Args:
|
|
14
|
+
client (FalabellaClient, optional): Instancia del cliente de Falabella.
|
|
15
|
+
"""
|
|
16
|
+
self._client = client
|
|
17
|
+
|
|
18
|
+
@property
|
|
19
|
+
def client(self) -> 'FalabellaClient':
|
|
20
|
+
"""Obtiene la instancia del cliente para este recurso.
|
|
21
|
+
|
|
22
|
+
Raises:
|
|
23
|
+
ValueError: Si el cliente no ha sido inicializado.
|
|
24
|
+
"""
|
|
25
|
+
if self._client is not None:
|
|
26
|
+
return self._client
|
|
27
|
+
raise ValueError("El cliente no ha sido inicializado para este recurso.")
|
|
28
|
+
|
|
29
|
+
@client.setter
|
|
30
|
+
def client(self, value: Optional['FalabellaClient']) -> None:
|
|
31
|
+
"""Establece la instancia del cliente para este recurso."""
|
|
32
|
+
self._client = value
|