Skip to main content

funapi-sciencedb

科学数据银行(ScienceDB)Open API 的 Python 客户端,由 openapi-python-client 根据 ScienceDB 官方 OpenAPI 文档(https://www.scidb.cn/open-api/v2/api-docs)自动生成,仓库里的 generate.py 就是重新拉取该文档并重新生成客户端代码的脚本。

安装

pip install funapi-sciencedb

用法示例

from funapi_sciencedb import Client
from funapi_sciencedb.api.open_api_controller import search_using_get

client = Client(base_url="https://www.scidb.cn/open-api/v2")

# 按发布时间倒序分页搜索数据集
result = search_using_get.sync(client=client, page=1, size=10)

除了开放接口(open_api_controller,搜索/harvest/metrics/json 等),还包含 COUNTER 标准的用量统计报表接口(sushi_controller:get_api_status、get_reports、get_report_by_id_using_get)。每个接口都提供 sync / sync_detailed / asyncio / asyncio_detailed 四种调用方式,返回值是 models/ 目录下对应的强类型模型对象。

由于是自动生成的客户端,具体字段和返回结构以 src/funapi_sciencedb/models/ 下的类定义为准。

重新生成客户端

generate.py 会重新拉取 ScienceDB 官方 OpenAPI 文档并重新生成 src/funapi_sciencedb/ 下的全部代码,运行前需要安装 generate 依赖组:

uv sync --group generate
uv run python generate.py
ruff check --fix . && ruff format .

生成器模板和上游 OpenAPI 文档都是英文的,generate.py 会自动调用 localize.py 把 docstring 换成中文:拉取文档后替换文档里的 summary / description,生成代码后再替换模板自带的 Args:、Client 类说明等。

映射表是精确匹配的,上游新增文案不会被瞎翻、而是原样保留。补完映射后可以单独重跑或自查:

uv run python localize.py          # 重新应用中文化
uv run python localize.py --check  # 只检查,列出还没中文化的 docstring

关于 farfarfun

farfarfun 是一个专注于实用工具库的开源组织, 涵盖云存储、数据处理、AI、多媒体与开发工具链等方向。

本项目基于 MIT 协议开源。

Metadata

Release files for funapi-sciencedb 1.1.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for funapi-sciencedb 1.1.2
File Size Uploaded Provenance Actions
funapi_sciencedb-1.1.2.tar.gz 49.4 kB Without provenance Details for funapi_sciencedb-1.1.2.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for funapi-sciencedb 1.1.2
File Interpreter ABI Platform Actions
funapi_sciencedb-1.1.2-py3-none-any.whl Python 3 none any Details for funapi_sciencedb-1.1.2-py3-none-any.whl

Total release size: 104.2 kB

Release files / funapi_sciencedb-1.1.2.tar.gz

Download URL funapi_sciencedb-1.1.2.tar.gz
Size 49.4 kB
Tags Source
SHA-256 checksum
How to use checksums
e50c8a3b2ffa936d6f175e34cde963edf049824aa459317b09b4234d50d564a7
BLAKE2b-256 checksum
How to use checksums
588efb5db481cf300e3b12f5dee3894984346e1eaed12db8b7cd3c7e108141c7
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.11.17 {"installer":{"name":"uv","version":"0.11.17","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

Release files / funapi_sciencedb-1.1.2-py3-none-any.whl

Download URL funapi_sciencedb-1.1.2-py3-none-any.whl
Size 54.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
4f56409bbcd168b3d57df689be7015cab1675e1e576dcf79b365512837637dee
BLAKE2b-256 checksum
How to use checksums
bc5e0be69fc6ff363190e04b19e9b785e4334707bafec5841180a0c6f574a280
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.11.17 {"installer":{"name":"uv","version":"0.11.17","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

Security for funapi-sciencedb 1.1.2

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

1.1.2 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page