goofish-api 0.0.4__tar.gz → 0.0.6__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 (26) hide show
  1. goofish_api-0.0.6/PKG-INFO +414 -0
  2. goofish_api-0.0.6/README.md +403 -0
  3. {goofish_api-0.0.4 → goofish_api-0.0.6}/goofish_api/__init__.py +2 -2
  4. goofish_api-0.0.6/goofish_api/__version__.py +1 -0
  5. {goofish_api-0.0.4 → goofish_api-0.0.6}/goofish_api/api/order.py +23 -21
  6. goofish_api-0.0.6/goofish_api.egg-info/PKG-INFO +414 -0
  7. goofish_api-0.0.4/PKG-INFO +0 -31
  8. goofish_api-0.0.4/README.md +0 -20
  9. goofish_api-0.0.4/goofish_api/__version__.py +0 -1
  10. goofish_api-0.0.4/goofish_api.egg-info/PKG-INFO +0 -31
  11. {goofish_api-0.0.4 → goofish_api-0.0.6}/LICENSE +0 -0
  12. {goofish_api-0.0.4 → goofish_api-0.0.6}/goofish_api/api/__init__.py +0 -0
  13. {goofish_api-0.0.4 → goofish_api-0.0.6}/goofish_api/api/base.py +0 -0
  14. {goofish_api-0.0.4 → goofish_api-0.0.6}/goofish_api/api/good.py +0 -0
  15. {goofish_api-0.0.4 → goofish_api-0.0.6}/goofish_api/api/other.py +0 -0
  16. {goofish_api-0.0.4 → goofish_api-0.0.6}/goofish_api/api/user.py +0 -0
  17. {goofish_api-0.0.4 → goofish_api-0.0.6}/goofish_api/utils/__init__.py +0 -0
  18. {goofish_api-0.0.4 → goofish_api-0.0.6}/goofish_api/utils/api_response.py +0 -0
  19. {goofish_api-0.0.4 → goofish_api-0.0.6}/goofish_api/utils/base_client.py +0 -0
  20. {goofish_api-0.0.4 → goofish_api-0.0.6}/goofish_api/utils/constants.py +0 -0
  21. {goofish_api-0.0.4 → goofish_api-0.0.6}/goofish_api/utils/helpers.py +0 -0
  22. {goofish_api-0.0.4 → goofish_api-0.0.6}/goofish_api.egg-info/SOURCES.txt +0 -0
  23. {goofish_api-0.0.4 → goofish_api-0.0.6}/goofish_api.egg-info/dependency_links.txt +0 -0
  24. {goofish_api-0.0.4 → goofish_api-0.0.6}/goofish_api.egg-info/top_level.txt +0 -0
  25. {goofish_api-0.0.4 → goofish_api-0.0.6}/setup.cfg +0 -0
  26. {goofish_api-0.0.4 → goofish_api-0.0.6}/setup.py +0 -0
@@ -0,0 +1,414 @@
1
+ Metadata-Version: 2.1
2
+ Name: goofish_api
3
+ Version: 0.0.6
4
+ Summary: Python wrapper for the goofish API
5
+ Home-page: https://github.com/xie7654/goofish_api
6
+ Author: XIE JUN
7
+ Author-email: xie765462425@gmail.com
8
+ License: MIT
9
+ Description-Content-Type: text/markdown
10
+ License-File: LICENSE
11
+
12
+ # Goofish API Python SDK
13
+
14
+ [![Python Version](https://img.shields.io/badge/python-3.7+-blue.svg)](https://python.org)
15
+ [![License](https://img.shields.io/badge/license-MIT-green.svg)](LICENSE)
16
+
17
+ Goofish API Python SDK 是一个用于闲鱼开放平台的Python客户端库,提供了完整的API封装,支持商品管理、订单处理、用户授权等功能。
18
+
19
+
20
+ **<font color="red">使用邀请码订购会员可享最高85折优惠,立减30: 需要邀请码可加wx: JUN765462425</font>**
21
+
22
+ ## 功能特性
23
+
24
+ - 🚀 **完整的API覆盖** - 支持闲鱼开放平台的所有主要API
25
+ - 🔐 **自动签名验证** - 内置MD5签名算法,无需手动处理
26
+ - 📦 **模块化设计** - 按功能模块组织代码,易于使用和维护
27
+ - 🛡️ **类型安全** - 使用枚举类型确保参数正确性
28
+ - 📝 **详细文档** - 每个API都有详细的参数说明和示例
29
+
30
+ ## 支持的API模块
31
+
32
+ - **用户模块** - 店铺授权管理
33
+ - **商品模块** - 商品CRUD操作、类目管理、属性查询
34
+ - **订单模块** - 订单查询、发货处理、卡密管理
35
+ - **其他模块** - 快递公司查询等
36
+
37
+ ## 安装
38
+
39
+ ### 从PyPI安装
40
+
41
+ ```bash
42
+ pip install goofish-api
43
+ ```
44
+
45
+ ## 依赖要求
46
+
47
+ - Python 3.7+
48
+ - requests >= 2.26.0
49
+ - python-dotenv >= 0.20.0
50
+
51
+ ## 快速开始
52
+ ### 1. 基本使用
53
+
54
+ ```python
55
+ from goofish_api import GoofishClient
56
+
57
+ APP_KEY = ''
58
+ APP_SECRET = ''
59
+ # 初始化客户端
60
+ client = GoofishClient(
61
+ app_key=APP_KEY,
62
+ app_secret=APP_SECRET
63
+ )
64
+
65
+
66
+ # 查询授权店铺
67
+ response = client.user.get_authorize_list()
68
+ print(response)
69
+ ```
70
+
71
+ ## API 使用示例
72
+
73
+ ### 用户模块
74
+
75
+ #### 查询授权店铺
76
+
77
+ ```python
78
+ # 获取已授权的闲鱼店铺列表
79
+ response = client.user.get_authorize_list()
80
+ print(response)
81
+ ```
82
+
83
+ ### 商品模块
84
+
85
+ #### 查询商品类目
86
+
87
+ ```python
88
+ from goofish_api.utils.constants import ItemBizType, SpBizType
89
+
90
+ # 查询普通商品的手机类目
91
+ response = client.good.get_product_category_list(
92
+ item_biz_type=ItemBizType.COMMON,
93
+ sp_biz_type=SpBizType.MOBILE
94
+ )
95
+ print(response)
96
+ ```
97
+
98
+ #### 查询商品属性
99
+
100
+ ```python
101
+ # 查询指定类目的商品属性
102
+ response = client.good.get_product_pv_list(
103
+ item_biz_type=ItemBizType.COMMON,
104
+ sp_biz_type=SpBizType.MOBILE,
105
+ channel_cat_id="4d8b31d719602249ac899d2620c5df2b"
106
+ )
107
+ print(response)
108
+ ```
109
+
110
+ #### 查询商品列表
111
+
112
+ ```python
113
+ from goofish_api.utils.constants import ProductStatus, SaleStatus
114
+
115
+ # 查询销售中的商品
116
+ response = client.good.get_product_list(
117
+ product_status=ProductStatus.STATUS_21,
118
+ sale_status=SaleStatus.ON_SALE,
119
+ page_no=1,
120
+ page_size=20
121
+ )
122
+ print(response)
123
+ ```
124
+
125
+ #### 查询商品详情
126
+
127
+ ```python
128
+ # 根据商品ID查询详情
129
+ response = client.good.get_product_detail(product_id=1234567890)
130
+ print(response)
131
+ ```
132
+
133
+ #### 创建商品
134
+
135
+ ```python
136
+ # 创建单个商品
137
+ product_data = {
138
+ "item_biz_type": 2,
139
+ "sp_biz_type": 1,
140
+ "channel_cat_id": "e11455b218c06e7ae10cfa39bf43dc0f",
141
+ "channel_pv": [
142
+ {
143
+ "property_id": "b5e5462c028aba7f1921b9e373cead75",
144
+ "property_name": "交易形式",
145
+ "value_id": "8a3445658e0bc44687b43d68bdc44732",
146
+ "value_name": "代下单"
147
+ }
148
+ ],
149
+ "price": 550000, # 价格(分)
150
+ "original_price": 700000,
151
+ "express_fee": 10,
152
+ "stock": 10,
153
+ "outer_id": "2021110112345",
154
+ "stuff_status": 100,
155
+ "publish_shop": [
156
+ {
157
+ "images": ["https://example.com/image1.jpg"],
158
+ "user_name": "闲鱼会员名",
159
+ "province": 130000,
160
+ "city": 130100,
161
+ "district": 130101,
162
+ "title": "商品标题",
163
+ "content": "商品描述",
164
+ "service_support": "SDR"
165
+ }
166
+ ]
167
+ }
168
+
169
+ response = client.good.create_product(product_data=product_data)
170
+ print(response)
171
+ ```
172
+
173
+ #### 批量创建商品
174
+
175
+ ```python
176
+ # 批量创建商品
177
+ product_list = [product_data1, product_data2, product_data3]
178
+ response = client.good.product_batch_create(product_data=product_list)
179
+ print(response)
180
+ ```
181
+
182
+ #### 发布商品
183
+
184
+ ```python
185
+ # 发布商品到闲鱼
186
+ response = client.good.product_publish(
187
+ product_id=1234567890,
188
+ user_name=["闲鱼会员名1", "闲鱼会员名2"]
189
+ )
190
+ print(response)
191
+ ```
192
+
193
+ #### 下架商品
194
+
195
+ ```python
196
+ # 下架商品
197
+ response = client.good.product_down_shelf(product_id=1234567890)
198
+ print(response)
199
+ ```
200
+
201
+ #### 编辑商品
202
+
203
+ ```python
204
+ # 编辑商品信息
205
+ edit_data = {
206
+ "product_id": 1234567890,
207
+ "title": "新的商品标题",
208
+ "price": 600000,
209
+ "stock": 20
210
+ }
211
+ response = client.good.product_edit(product_data=edit_data)
212
+ print(response)
213
+ ```
214
+
215
+ #### 修改库存
216
+
217
+ ```python
218
+ # 修改商品库存和价格
219
+ response = client.good.product_edit_stock(
220
+ product_id=1234567890,
221
+ price=600000,
222
+ stock=15
223
+ )
224
+ print(response)
225
+ ```
226
+
227
+ #### 删除商品
228
+
229
+ ```python
230
+ # 删除商品
231
+ response = client.good.product_delete(product_id=1234567890)
232
+ print(response)
233
+ ```
234
+
235
+ ### 订单模块
236
+
237
+ #### 查询订单列表
238
+
239
+ ```python
240
+ from goofish_api.utils.constants import OrderStatus, RefundStatus
241
+
242
+ # 查询待发货订单
243
+ response = client.order.get_order_list(
244
+ order_status=OrderStatus.PENDING_SHIPMENT,
245
+ page_no=1,
246
+ page_size=20
247
+ )
248
+ print(response)
249
+ ```
250
+
251
+ #### 查询订单详情
252
+
253
+ ```python
254
+ # 根据订单号查询详情
255
+ response = client.order.get_order_detail(order_no="1339920336328048683")
256
+ print(response)
257
+ ```
258
+
259
+ #### 查询订单卡密
260
+
261
+ ```python
262
+ # 查询订单的卡密信息
263
+ response = client.order.kam_order_list(order_no="1339920336328048683")
264
+ print(response)
265
+ ```
266
+
267
+ #### 订单发货
268
+
269
+ ```python
270
+ # 订单物流发货
271
+ response = client.order.order_ship(
272
+ order_no="1339920336328048683",
273
+ ship_name="张三",
274
+ ship_mobile="13800138000",
275
+ ship_district_id=440305,
276
+ ship_prov_name="广东省",
277
+ ship_city_name="深圳市",
278
+ ship_area_name="南山区",
279
+ waybill_no="25051016899982",
280
+ express_name="其他",
281
+ express_code="qita"
282
+ )
283
+ print(response)
284
+ ```
285
+
286
+ ### 其他模块
287
+
288
+ #### 查询快递公司
289
+
290
+ ```python
291
+ # 获取支持的快递公司列表
292
+ response = client.other.get_express_companies()
293
+ print(response)
294
+ ```
295
+
296
+ ## 常量枚举
297
+
298
+ SDK提供了丰富的枚举类型,确保API调用的参数正确性:
299
+
300
+ ### 商品类型 (ItemBizType)
301
+
302
+ ```python
303
+ from goofish_api.utils.constants import ItemBizType
304
+
305
+ ItemBizType.COMMON # 普通商品
306
+ ItemBizType.INSPECTED # 已验货
307
+ ItemBizType.INSPECTION_BAO # 验货宝
308
+ ItemBizType.BRAND_AUTH # 品牌授权
309
+ ItemBizType.XIAN_YU_SELECTED # 闲鱼严选
310
+ ItemBizType.XIAN_YU_FLASH # 闲鱼特卖
311
+ ItemBizType.BRAND_PICK # 品牌捡漏
312
+ ```
313
+
314
+ ### 行业类型 (SpBizType)
315
+
316
+ ```python
317
+ from goofish_api.utils.constants import SpBizType
318
+
319
+ SpBizType.MOBILE # 手机
320
+ SpBizType.TREND # 潮品
321
+ SpBizType.HOME_APPLIANCE # 家电
322
+ SpBizType.DIGITAL # 3C数码
323
+ SpBizType.LUXURY # 奢品
324
+ SpBizType.MATERNAL # 母婴
325
+ SpBizType.BEAUTY # 美妆个护
326
+ # ... 更多类型
327
+ ```
328
+
329
+ ### 订单状态 (OrderStatus)
330
+
331
+ ```python
332
+ from goofish_api.utils.constants import OrderStatus
333
+
334
+ OrderStatus.PENDING_PAYMENT # 待付款
335
+ OrderStatus.PENDING_SHIPMENT # 待发货
336
+ OrderStatus.SHIPPED # 已发货
337
+ OrderStatus.TRANSACTION_SUCCESS # 交易成功
338
+ OrderStatus.REFUNDED # 已退款
339
+ OrderStatus.TRANSACTION_CLOSED # 交易关闭
340
+ ```
341
+
342
+ ### 退款状态 (RefundStatus)
343
+
344
+ ```python
345
+ from goofish_api.utils.constants import RefundStatus
346
+
347
+ RefundStatus.NOT_APPLIED # 未申请退款
348
+ RefundStatus.PENDING_SELLER_APPROVAL # 待商家处理
349
+ RefundStatus.PENDING_BUYER_RETURN # 待买家退货
350
+ RefundStatus.PENDING_SELLER_RECEIVE # 待商家收货
351
+ RefundStatus.REFUND_CLOSED # 退款关闭
352
+ RefundStatus.REFUND_SUCCESS # 退款成功
353
+ RefundStatus.REFUND_REJECTED # 已拒绝退款
354
+ RefundStatus.PENDING_RETURN_ADDRESS_CONFIRMATION # 待确认退货地址
355
+ ```
356
+
357
+ ## 错误处理
358
+
359
+ SDK会自动处理API响应,返回统一的响应格式:
360
+
361
+ ```python
362
+ response = client.user.get_authorize_list()
363
+
364
+ if response.success:
365
+ print("请求成功:", response.data)
366
+ else:
367
+ print("请求失败:", response.message)
368
+ print("错误代码:", response.code)
369
+ ```
370
+
371
+ ## 调试模式
372
+
373
+ 启用调试模式可以查看详细的请求和响应信息:
374
+
375
+ ```python
376
+ client = GoofishClient(
377
+ app_key="your_app_key",
378
+ app_secret="your_app_secret",
379
+ debug=True # 启用调试模式
380
+ )
381
+ ```
382
+
383
+ ## 测试示例
384
+
385
+ 项目包含完整的测试示例,位于 `test/` 目录:
386
+
387
+ ```bash
388
+ # 运行测试
389
+ cd test
390
+ python go.py
391
+ ```
392
+
393
+ ## 贡献
394
+
395
+ 欢迎提交Issue和Pull Request来改进这个项目。
396
+
397
+ ## 许可证
398
+
399
+ 本项目采用 MIT 许可证 - 查看 [LICENSE](LICENSE) 文件了解详情。
400
+
401
+ ## 作者
402
+
403
+ - **XIE JUN** - [xie7654](https://github.com/xie7654)
404
+ - 邮箱: xie765462425@gmail.com,765462425@qq.com
405
+
406
+ ## 相关链接
407
+
408
+ - [闲鱼开放平台文档](https://open.goofish.pro)
409
+ - [GitHub 仓库](https://github.com/xie7654/goofish_api)
410
+ - [PyPI 包](https://pypi.org/project/goofish-api/)
411
+
412
+ ---
413
+
414
+ 如有问题或建议,请通过GitHub Issues联系我们。或qq:765462425 wx:JUN765462425