|
5 | 5 |
|
6 | 6 | # Just One API - Python SDK |
7 | 7 |
|
8 | | -Official Python SDK for accessing [Just One API](https://justoneapi.com) — a unified data service platform offering structured data from Social, E-commerce platforms such as Xiaohongshu, Taobao, Douyin, Kuaishou, Bilibili, and Weibo. |
| 8 | +Official Python SDK for accessing [Just One API](https://justoneapi.com). |
9 | 9 |
|
10 | | -This SDK simplifies API integration and request signing, allowing developers to easily retrieve platform-specific data with minimal setup. |
| 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. |
11 | 11 |
|
12 | | ---- |
13 | | - |
14 | | -## 🧧 Featured Project (Separate Service) |
15 | | - |
16 | | -### [Just Serp API](https://justserpapi.com/) |
17 | | -> **Note:** This is an independent project and not part of the Just One API Python SDK. |
18 | | -
|
19 | | -Need search engine data? Check out Just Serp API — a high-performance SERP API providing structured data from Google, Bing, and other search engines. |
20 | | - |
21 | | ---- |
22 | | - |
23 | | -## 🚀 Installation |
24 | | - |
25 | | -Install via PyPI: |
| 12 | +## Installation |
26 | 13 |
|
27 | 14 | ```bash |
28 | 15 | pip install justoneapi |
29 | 16 | ``` |
30 | 17 |
|
31 | | ---- |
32 | | - |
33 | | -## 🛠 Quick Start |
| 18 | +## Quick Start |
34 | 19 |
|
35 | 20 | ```python |
36 | | -from justoneapi.client import JustOneAPIClient |
| 21 | +from justoneapi import JustOneAPIClient |
37 | 22 |
|
38 | 23 | client = JustOneAPIClient(token="your_token") |
| 24 | +response = client.douyin.get_video_detail_v2(video_id="7428906452091145483") |
39 | 25 |
|
40 | | -# Example: Get Douyin Video detail |
41 | | -result, data, message = client.douyin.get_video_detail_v2(video_id="7428906452091145483") |
42 | | -print(result) |
43 | | -print(data) |
44 | | -print(message) |
45 | | - |
46 | | -# Example: Douyin Video Search |
47 | | -result, data, message, has_next_page = client.douyin.search_video_v4(keyword="deepseek", sort_type="_0", publish_time="_0", duration="_0", page=1) |
48 | | -print(result) |
49 | | -print(data) |
50 | | -print(message) |
51 | | -print(has_next_page) |
| 26 | +print(response.success) |
| 27 | +print(response.code) |
| 28 | +print(response.message) |
| 29 | +print(response.data) |
52 | 30 | ``` |
53 | 31 |
|
54 | | -### 📦 Return Value Description |
55 | | - |
56 | | -Each API method returns one or more of the following values: |
57 | | - |
58 | | -| Variable | Type | Description | |
59 | | -|------------------|----------|-------------| |
60 | | -| `result` | `bool` | Whether the request was successful. `True` means success, `False` means failure. | |
61 | | -| `data` | `dict` / `list` | The actual data returned from the API. Structure varies by endpoint. | |
62 | | -| `message` | `str` | Message from the server. Contains error info when request fails. | |
63 | | -| `has_next_page` | `bool` | Present in paginated APIs. Indicates whether more data is available. | |
64 | | - |
65 | | ---- |
66 | | - |
67 | | -## 🔐 Authentication |
| 32 | +## Response Shape |
68 | 33 |
|
69 | | -All API requests require a valid API token. |
70 | | -👉 [Register](https://dashboard.justoneapi.com/en/register) |
| 34 | +Every API method returns an `ApiResponse` instance with these fields: |
71 | 35 |
|
72 | | ---- |
| 36 | +| Field | Type | Description | |
| 37 | +| --- | --- | --- | |
| 38 | +| `success` | `bool` | `True` only when `code == 0`. | |
| 39 | +| `code` | `Any` | Raw business code returned by the API. | |
| 40 | +| `message` | `str` | Server message. | |
| 41 | +| `data` | `Any` | Response payload from the API. | |
| 42 | +| `raw_json` | `dict` | Full response payload before SDK normalization. | |
73 | 43 |
|
74 | | -## 📚 Documentation |
| 44 | +## Authentication |
75 | 45 |
|
76 | | -👉 Full API docs: [API Document](https://docs.justoneapi.com/en) |
| 46 | +All API requests require a valid API token. |
77 | 47 |
|
78 | | -Includes: |
79 | | -- Request parameters |
80 | | -- Response fields |
81 | | -- Error codes |
| 48 | +## OpenAPI Sync |
82 | 49 |
|
83 | | ---- |
| 50 | +The repository ships scripts for the generation pipeline: |
84 | 51 |
|
85 | | -## 🏠 Official Website |
86 | | - |
87 | | -👉 [Home Page](https://justoneapi.com) |
88 | | - |
89 | | -Learn more about the project, data sources, and commercial integration opportunities. |
90 | | - |
91 | | ---- |
92 | | - |
93 | | -## 📬 Contact Us |
94 | | - |
95 | | -If you have any questions, feedback, or partnership inquiries: |
96 | | - |
97 | | -👉 [Contact](https://justoneapi.com/en/contact) |
98 | | - |
99 | | ---- |
100 | | - |
101 | | -## 🪪 License |
| 52 | +```bash |
| 53 | +python3.11 scripts/fetch_openapi.py |
| 54 | +python3.11 scripts/normalize_openapi.py |
| 55 | +python3.11 scripts/generate_sdk.py |
| 56 | +``` |
102 | 57 |
|
103 | | -This project is licensed under the MIT License. |
104 | | -See the [LICENSE](./LICENSE) file for details. |
| 58 | +`fetch_openapi.py` reads credentials from `OPENAPI_BASIC_AUTH_USERNAME` and `OPENAPI_BASIC_AUTH_PASSWORD` by default. |
0 commit comments