Skip to content

Commit 962f45b

Browse files
author
Anonymous Committer
committed
chore: remove unused API implementation and associated tests
1 parent 84050fa commit 962f45b

79 files changed

Lines changed: 78657 additions & 1684 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/workflows/ci.yml

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
name: ci
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
pull_request:
8+
9+
jobs:
10+
test:
11+
runs-on: ubuntu-latest
12+
13+
steps:
14+
- uses: actions/checkout@v4
15+
16+
- uses: actions/setup-python@v5
17+
with:
18+
python-version: '3.11'
19+
20+
- name: Install dependencies
21+
run: python -m pip install -e '.[dev]'
22+
23+
- name: Normalize OpenAPI
24+
run: python scripts/normalize_openapi.py
25+
26+
- name: Generate SDK
27+
run: python scripts/generate_sdk.py
28+
29+
- name: Ensure generated artifacts are committed
30+
run: git diff --exit-code -- openapi/public-api.normalized.json justoneapi/generated
31+
32+
- name: Run tests
33+
run: python -m pytest

.github/workflows/sync-openapi.yml

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
name: sync-openapi
2+
3+
on:
4+
workflow_dispatch:
5+
schedule:
6+
- cron: '0 2 * * *'
7+
8+
jobs:
9+
sync:
10+
if: github.repository == 'justoneapi/justoneapi-python'
11+
runs-on: ubuntu-latest
12+
permissions:
13+
contents: write
14+
pull-requests: write
15+
16+
steps:
17+
- uses: actions/checkout@v4
18+
19+
- uses: actions/setup-python@v5
20+
with:
21+
python-version: '3.11'
22+
23+
- name: Install dependencies
24+
run: python -m pip install -e '.[dev]'
25+
26+
- name: Backup current spec
27+
run: cp openapi/public-api.json "$RUNNER_TEMP/public-api.previous.json"
28+
29+
- name: Fetch OpenAPI
30+
env:
31+
OPENAPI_BASIC_AUTH_USERNAME: ${{ secrets.OPENAPI_BASIC_AUTH_USERNAME }}
32+
OPENAPI_BASIC_AUTH_PASSWORD: ${{ secrets.OPENAPI_BASIC_AUTH_PASSWORD }}
33+
run: python scripts/fetch_openapi.py
34+
35+
- name: Normalize OpenAPI
36+
run: python scripts/normalize_openapi.py
37+
38+
- name: Generate SDK
39+
run: python scripts/generate_sdk.py
40+
41+
- name: Run tests
42+
run: python -m pytest
43+
44+
- name: Build sync summary
45+
run: python scripts/diff_openapi.py "$RUNNER_TEMP/public-api.previous.json" openapi/public-api.json --output "$RUNNER_TEMP/openapi-sync-summary.md"
46+
47+
- name: Create pull request
48+
uses: peter-evans/create-pull-request@v7
49+
with:
50+
branch: codex/openapi-sync
51+
delete-branch: true
52+
title: 'chore: sync OpenAPI spec and generated SDK'
53+
commit-message: 'chore: sync OpenAPI spec and generated SDK'
54+
body-path: ${{ runner.temp }}/openapi-sync-summary.md

.gitignore

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,5 +6,10 @@ dist/
66
build/
77
.venv/
88
.idea/
9+
.pytest_cache/
10+
.mypy_cache/
11+
.coverage
12+
coverage.xml
13+
openapi/public-api.previous.json
914
**/.DS_Store
1015
tests/_trial_temp/

README.md

Lines changed: 29 additions & 75 deletions
Original file line numberDiff line numberDiff line change
@@ -5,100 +5,54 @@
55

66
# Just One API - Python SDK
77

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).
99

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.
1111

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
2613

2714
```bash
2815
pip install justoneapi
2916
```
3017

31-
---
32-
33-
## 🛠 Quick Start
18+
## Quick Start
3419

3520
```python
36-
from justoneapi.client import JustOneAPIClient
21+
from justoneapi import JustOneAPIClient
3722

3823
client = JustOneAPIClient(token="your_token")
24+
response = client.douyin.get_video_detail_v2(video_id="7428906452091145483")
3925

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)
5230
```
5331

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
6833

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:
7135

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. |
7343

74-
## 📚 Documentation
44+
## Authentication
7545

76-
👉 Full API docs: [API Document](https://docs.justoneapi.com/en)
46+
All API requests require a valid API token.
7747

78-
Includes:
79-
- Request parameters
80-
- Response fields
81-
- Error codes
48+
## OpenAPI Sync
8249

83-
---
50+
The repository ships scripts for the generation pipeline:
8451

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+
```
10257

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.

README.zh-CN.md

Lines changed: 27 additions & 76 deletions
Original file line numberDiff line numberDiff line change
@@ -5,99 +5,50 @@
55

66
# Just One API - Python SDK
77

8-
官方 Python SDK,用于访问 [Just One API](https://justoneapi.com/zh/) —— 一个统一的数据服务平台,提供来自小红书、淘宝、抖音、快手、哔哩哔哩、微博等社交、电商平台的结构化数据
8+
官方 Python SDK,用于访问 [Just One API](https://justoneapi.com/zh/)
99

10-
该 SDK 简化了 API 调用与签名流程,让开发者能够以最少的配置快速获取各平台数据
10+
2.x 版本改为基于公开 OpenAPI 文档自动生成,覆盖完整 `public-api` 接口面,返回值也改为 `ApiResponse` 对象,不再返回 tuple
1111

12-
---
13-
14-
## 🧧 推荐项目(外部独立服务)
15-
16-
### [Just Serp API](https://justserpapi.com/)
17-
> **注意:** 这是一个与 Just One API 相互独立的另一个项目,不属于本项目 SDK。
18-
19-
如果您需要搜索引擎数据,请访问 Just Serp API — 高性能的 SERP API,提供来自 Google、Bing 等搜索引擎的结构化数据。
20-
21-
---
22-
23-
## 🚀 安装
24-
25-
通过 PyPI 安装:
12+
## 安装
2613

2714
```bash
2815
pip install justoneapi
2916
```
3017

31-
---
32-
33-
## 🛠 快速开始
18+
## 快速开始
3419

3520
```python
36-
from justoneapi.client import JustOneAPIClient
21+
from justoneapi import JustOneAPIClient
3722

3823
client = JustOneAPIClient(token="your_token")
24+
response = client.douyin.get_video_detail_v2(video_id="7428906452091145483")
3925

40-
# 示例:获取抖音视频详情
41-
result, data, message = client.douyin.get_video_detail_v2(video_id="7428906452091145483")
42-
print(result)
43-
print(data)
44-
print(message)
45-
46-
# 示例:抖音视频搜索
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)
5230
```
5331

54-
### 📦 返回值说明
55-
56-
每个 API 方法会返回以下一个或多个值:
57-
58-
| 变量名 | 类型 | 说明 |
59-
|--------|------|------|
60-
| `result` | `bool` | 请求是否成功。`True` 表示成功,`False` 表示失败。 |
61-
| `data` | `dict` / `list` | 实际返回的数据,结构因接口而异。 |
62-
| `message` | `str` | 服务器返回的信息;当请求失败时包含错误说明。 |
63-
| `has_next_page` | `bool` | 仅分页接口返回,表示是否还有下一页数据。 |
64-
65-
---
66-
67-
## 🔐 身份认证
32+
## 返回结构
6833

69-
所有 API 请求均需携带有效的 API Token。
70-
👉 [注册获取 Token](https://dashboard.justoneapi.com/zh/register)
34+
每个 API 方法都会返回一个 `ApiResponse` 对象,包含以下字段:
7135

72-
---
36+
| 字段 | 类型 | 说明 |
37+
| --- | --- | --- |
38+
| `success` | `bool` | 仅当 `code == 0` 时为 `True`|
39+
| `code` | `Any` | 服务端返回的业务码。 |
40+
| `message` | `str` | 服务端消息。 |
41+
| `data` | `Any` | API 返回的业务数据。 |
42+
| `raw_json` | `dict` | SDK 处理前的完整 JSON 响应。 |
7343

74-
## 📚 文档中心
44+
## OpenAPI 同步
7545

76-
👉 完整 API 文档:[接口文档](https://docs.justoneapi.com/zh)
46+
仓库内置了生成链路脚本:
7747

78-
内容包括:
79-
- 请求参数
80-
- 返回字段
81-
- 错误码说明
82-
83-
---
84-
85-
## 🏠 官方网站
86-
87-
👉 [官方网站](https://justoneapi.com/zh/)
88-
89-
了解更多项目介绍、数据来源及商业集成方案。
90-
91-
---
92-
93-
## 📬 联系我们
94-
95-
如有任何问题、反馈或合作意向,欢迎联系:
96-
👉 [联系我们](https://justoneapi.com/zh/contact)
97-
98-
---
99-
100-
## 🪪 许可证
48+
```bash
49+
python3.11 scripts/fetch_openapi.py
50+
python3.11 scripts/normalize_openapi.py
51+
python3.11 scripts/generate_sdk.py
52+
```
10153

102-
本项目基于 MIT 开源许可证发布。
103-
详情参见 [LICENSE](./LICENSE) 文件。
54+
默认会从环境变量 `OPENAPI_BASIC_AUTH_USERNAME``OPENAPI_BASIC_AUTH_PASSWORD` 读取 swagger 的 Basic Auth 凭据。

justoneapi/__init__.py

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,20 @@
1-
__version__ = "1.16.1"
1+
from justoneapi._exceptions import (
2+
BusinessError,
3+
JustOneAPIError,
4+
ProtocolError,
5+
TransportError,
6+
VersionDeprecatedError,
7+
)
8+
from justoneapi._response import ApiResponse
9+
from justoneapi._version import __version__
10+
from justoneapi.client import JustOneAPIClient
11+
12+
__all__ = [
13+
"ApiResponse",
14+
"BusinessError",
15+
"JustOneAPIClient",
16+
"JustOneAPIError",
17+
"ProtocolError",
18+
"TransportError",
19+
"VersionDeprecatedError",
20+
]

0 commit comments

Comments
 (0)