Skip to main content

pipeline-http-sdk

定位

pipeline-http-sdk 是 pipeline-http-service 的 Python 客户端,提供接近 Tushare 的调用体验,返回 pandas.DataFrame。

安装

pip install pipeline-http-sdk

快速开始

import pipeline_sdk as ts

ts.set_token("your-token")
pro = ts.pro_api()

df = pro.stock_basic(
    fields="ts_code,name,list_date",
    order_by="list_date",
    sort="desc",
    limit=20,
)
print(df.head())

核心接口

统一查询:

df = pro.query(
    "stock_basic",
    ts_code="000001.SZ",
    fields=["ts_code", "name", "list_date"],
    order_by="list_date",
    sort="desc",
    limit=200,
    offset=0,
)

动态方法(等价于 query):

df = pro.stock_basic(ts_code="000001.SZ", limit=50)

获取 API 列表:

apis = pro.list_apis(enabled_only=True)

核心能力

  • set_token() + pro_api() 初始化
  • pro.query(...) 统一查询
  • pro.xxx(...) 动态 API 调用
  • pro.list_apis(...) 拉取可用接口

参数约定

  • 支持普通参数和列表参数
  • 支持分页:limit / offset
  • 支持排序:order_by / sort(asc、desc)
  • 参数语义由服务端解释

异常处理

HTTP 或业务错误会抛出 PipelineSDKError:

from pipeline_sdk import PipelineSDKError

try:
    df = pro.query("stock_basic", limit=10)
except PipelineSDKError as exc:
    print("message:", exc)
    print("code:", exc.code)
    print("detail:", exc.detail)

常见错误消息:

  • unauthorized(401)
  • 其它服务端 message(统一透传)

开发与发布

python -m pip install --upgrade build twine
python -m build
python -m twine check dist/*

更多发布步骤:docs/PYPI_PUBLISH.md。

Metadata

Release files for pipeline-http-sdk 0.1.1

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

Source distribution (sdist)

Source distribution for pipeline-http-sdk 0.1.1
File Size Uploaded Provenance Actions
pipeline_http_sdk-0.1.1.tar.gz 5.7 kB Without provenance Details for pipeline_http_sdk-0.1.1.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for pipeline-http-sdk 0.1.1
File Interpreter ABI Platform Actions
pipeline_http_sdk-0.1.1-py3-none-any.whl Python 3 none any Details for pipeline_http_sdk-0.1.1-py3-none-any.whl

Total release size: 11.7 kB

Release files / pipeline_http_sdk-0.1.1.tar.gz

Download URL pipeline_http_sdk-0.1.1.tar.gz
Size 5.7 kB
Tags Source
SHA-256 checksum
How to use checksums
9e917400af7b007bb3baa69f31b8f3c289844e7e49b9c39b20d283438eb5777a
BLAKE2b-256 checksum
How to use checksums
d757898f3415fdd00d404551b14b5b4b34dd76e28b00262a655bbfcd2e3b530a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.12.7

Release files / pipeline_http_sdk-0.1.1-py3-none-any.whl

Download URL pipeline_http_sdk-0.1.1-py3-none-any.whl
Size 6.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
8ce0a61ec0740a03b425146c3906805fe6275641df1de69c5024b48ca2077013
BLAKE2b-256 checksum
How to use checksums
5be5659e5fc093960010bf941502f79206724efdfd015cd190e1d61ba4492ca6
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.12.7

Security for pipeline-http-sdk 0.1.1

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

0.1.1 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