Skip to main content

Time Server Package

一个提供JSON-RPC接口的时间服务器Python包,支持获取不同时区的当前时间。

功能特性

  • 提供tools/get_current_time JSON-RPC方法
  • 支持指定时区获取时间
  • 基于FastAPI框架构建
  • 包含命令行入口点

安装

pip install time-server-pkg

使用方法

作为命令行工具运行

time-server

作为Python模块导入

from time_server_pkg import app, get_current_time

# 获取当前时间
print(get_current_time())

# 获取指定时区的时间
print(get_current_time("Asia/Shanghai"))

API接口

服务器默认在http://localhost:8000启动,提供以下JSON-RPC方法:

tools/get_current_time

获取当前时间,可选参数:

  • timezone: 时区字符串,例如"Asia/Shanghai", "America/New_York"等

示例请求:

{
  "jsonrpc": "2.0",
  "method": "tools/get_current_time",
  "params": {"timezone": "Asia/Shanghai"},
  "id": 1
}

示例响应:

{
  "jsonrpc": "2.0",
  "result": "2023-11-15 14:30:45 CST",
  "id": 1
}

技术栈

  • Python 3.7+
  • FastAPI
  • Uvicorn
  • pytz

许可证

MIT License

Metadata

Release files for time-server-pkg 0.1.0

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

Source distribution (sdist)

Source distribution for time-server-pkg 0.1.0
File Size Uploaded Provenance
time_server_pkg-0.1.0.tar.gz 5.0 kB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for time-server-pkg 0.1.0
File Interpreter ABI Platform
time_server_pkg-0.1.0-py3-none-any.whl Python 3 none any Details

Total release size: 11.0 kB

Release files / time_server_pkg-0.1.0.tar.gz

Download URL time_server_pkg-0.1.0.tar.gz
Size 5.0 kB
Tags Source
SHA-256 checksum
How to use checksums
4217f3d28a78aa7e10f36e84835f68861c92013ae9bf7da8b122fe9252bcb495
BLAKE2b-256 checksum
How to use checksums
3bb487e6527ff93299cbaab5beb29f4428980a1f655a8b92a1d464e4e9c56c39
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.13.9

Release files / time_server_pkg-0.1.0-py3-none-any.whl

Download URL time_server_pkg-0.1.0-py3-none-any.whl
Size 6.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
b5572ce4b8f3aa65d62bc8b2cd080e2032cdcd34ec8b565ead0efb8b25ac77fd
BLAKE2b-256 checksum
How to use checksums
e6d3d2b48b166e46662ec61733c42f921d13c646bcd957277f656fdb91e6cbcb
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.13.9

Security for time-server-pkg 0.1.0

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