Skip to content

Commit 28085d2

Browse files
author
Anonymous Committer
committed
chore: update README with platform list, examples, error handling, and documentation links
1 parent 962f45b commit 28085d2

2 files changed

Lines changed: 118 additions & 28 deletions

File tree

README.md

Lines changed: 57 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,9 @@
55

66
# Just One API - Python SDK
77

8-
Official Python SDK for accessing [Just One API](https://justoneapi.com).
8+
Official Python SDK for accessing [Just One API](https://justoneapi.com) - a unified data service platform that provides structured data from social media, e-commerce, and content platforms.
99

10-
Version 2 is generated from the public OpenAPI document and covers the full `public-api` surface. The SDK now returns typed response objects instead of tuples.
10+
Supported platforms include Taobao & Tmall, Xiaohongshu, Xiaohongshu Pugongying, Douyin, Douyin Xingtu, Kuaishou, Weibo, Bilibili, JD, WeChat, Douban, TikTok, TikTok Shop, Youku, Instagram, YouTube, Reddit, Toutiao, Zhihu, Amazon, Facebook, X (Twitter), Beike, IMDb, and more. To explore the full API catalog, visit the [official website](https://justoneapi.com).
1111

1212
## Installation
1313

@@ -21,12 +21,14 @@ pip install justoneapi
2121
from justoneapi import JustOneAPIClient
2222

2323
client = JustOneAPIClient(token="your_token")
24-
response = client.douyin.get_video_detail_v2(video_id="7428906452091145483")
2524

26-
print(response.success)
27-
print(response.code)
28-
print(response.message)
29-
print(response.data)
25+
# Example: Douyin video search
26+
response = client.douyin.search_video_v4(keyword="deepseek")
27+
28+
print(response.success) # True only when code == 0
29+
print(response.code) # Business code returned by the API
30+
print(response.message) # Server message
31+
print(response.data) # Actual payload
3032
```
3133

3234
## Response Shape
@@ -41,18 +43,58 @@ Every API method returns an `ApiResponse` instance with these fields:
4143
| `data` | `Any` | Response payload from the API. |
4244
| `raw_json` | `dict` | Full response payload before SDK normalization. |
4345

46+
## Error Handling
47+
48+
By default, business failures do not raise exceptions. You can check `response.success`, `response.code`, and `response.message`.
49+
50+
If you prefer exceptions for non-zero business codes:
51+
52+
```python
53+
from justoneapi import JustOneAPIClient, BusinessError
54+
55+
client = JustOneAPIClient(
56+
token="your_token",
57+
raise_on_business_error=True,
58+
)
59+
60+
try:
61+
response = client.douyin.search_video_v4(keyword="deepseek")
62+
except BusinessError as exc:
63+
print(exc.response.code)
64+
print(exc.response.message)
65+
```
66+
4467
## Authentication
4568

4669
All API requests require a valid API token.
4770

48-
## OpenAPI Sync
71+
Register here:
4972

50-
The repository ships scripts for the generation pipeline:
73+
- [Get API Token](https://dashboard.justoneapi.com/en/register)
5174

52-
```bash
53-
python3.11 scripts/fetch_openapi.py
54-
python3.11 scripts/normalize_openapi.py
55-
python3.11 scripts/generate_sdk.py
56-
```
75+
## Documentation
76+
77+
Full API documentation:
78+
79+
- [API Documentation](https://docs.justoneapi.com/en)
80+
81+
The documentation includes:
82+
83+
- Request parameters
84+
- Response fields
85+
- Error codes
86+
- Platform-specific examples
87+
88+
## Official Website
89+
90+
- [Home Page](https://justoneapi.com)
91+
92+
## Contact
93+
94+
If you have questions, feedback, or partnership inquiries:
95+
96+
- [Contact Us](https://justoneapi.com/en/contact)
97+
98+
## License
5799

58-
`fetch_openapi.py` reads credentials from `OPENAPI_BASIC_AUTH_USERNAME` and `OPENAPI_BASIC_AUTH_PASSWORD` by default.
100+
This project is licensed under the MIT License.

README.zh-CN.md

Lines changed: 61 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,9 @@
77

88
官方 Python SDK,用于访问 [Just One API](https://justoneapi.com/zh/)
99

10-
2.x 版本改为基于公开 OpenAPI 文档自动生成,覆盖完整 `public-api` 接口面,返回值也改为 `ApiResponse` 对象,不再返回 tuple。
10+
Just One API 是一个统一的数据服务平台,提供来自社交媒体、电商和内容平台的结构化数据。
11+
12+
支持的平台包括淘宝、天猫、小红书、小红书蒲公英、抖音、抖音星图、快手、微博、哔哩哔哩、京东、微信、豆瓣、TikTok、TikTok Shop、优酷、Instagram、YouTube、Reddit、头条、知乎、亚马逊、Facebook、X(Twitter)、贝壳、IMDb 等接口。想了解更多,可以访问[官网](https://justoneapi.com/zh/)
1113

1214
## 安装
1315

@@ -21,12 +23,14 @@ pip install justoneapi
2123
from justoneapi import JustOneAPIClient
2224

2325
client = JustOneAPIClient(token="your_token")
24-
response = client.douyin.get_video_detail_v2(video_id="7428906452091145483")
2526

26-
print(response.success)
27-
print(response.code)
28-
print(response.message)
29-
print(response.data)
27+
# 示例:搜索抖音视频
28+
response = client.douyin.search_video_v4(keyword="deepseek")
29+
30+
print(response.success) # 仅当 code == 0 时为 True
31+
print(response.code) # 服务端返回的业务码
32+
print(response.message) # 服务端消息
33+
print(response.data) # 实际业务数据
3034
```
3135

3236
## 返回结构
@@ -41,14 +45,58 @@ print(response.data)
4145
| `data` | `Any` | API 返回的业务数据。 |
4246
| `raw_json` | `dict` | SDK 处理前的完整 JSON 响应。 |
4347

44-
## OpenAPI 同步
48+
## 错误处理
4549

46-
仓库内置了生成链路脚本:
50+
默认情况下,业务失败不会抛异常,你可以通过 `response.success``response.code``response.message` 自行判断。
4751

48-
```bash
49-
python3.11 scripts/fetch_openapi.py
50-
python3.11 scripts/normalize_openapi.py
51-
python3.11 scripts/generate_sdk.py
52+
如果你希望业务失败时直接抛异常:
53+
54+
```python
55+
from justoneapi import JustOneAPIClient, BusinessError
56+
57+
client = JustOneAPIClient(
58+
token="your_token",
59+
raise_on_business_error=True,
60+
)
61+
62+
try:
63+
response = client.douyin.search_video_v4(keyword="deepseek")
64+
except BusinessError as exc:
65+
print(exc.response.code)
66+
print(exc.response.message)
5267
```
5368

54-
默认会从环境变量 `OPENAPI_BASIC_AUTH_USERNAME``OPENAPI_BASIC_AUTH_PASSWORD` 读取 swagger 的 Basic Auth 凭据。
69+
## 身份认证
70+
71+
所有 API 请求都需要有效的 API Token。
72+
73+
注册链接:
74+
75+
- [注册获取 Token](https://dashboard.justoneapi.com/zh/register)
76+
77+
## 文档中心
78+
79+
完整接口文档:
80+
81+
- [API 文档](https://docs.justoneapi.com/zh)
82+
83+
文档中包含:
84+
85+
- 请求参数说明
86+
- 返回字段说明
87+
- 错误码说明
88+
- 各平台调用示例
89+
90+
## 官方网站
91+
92+
- [官方网站](https://justoneapi.com/zh/)
93+
94+
## 联系我们
95+
96+
如果你有任何问题、反馈或合作需求:
97+
98+
- [联系我们](https://justoneapi.com/zh/contact)
99+
100+
## 许可证
101+
102+
本项目基于 MIT License 发布。

0 commit comments

Comments
 (0)