Skip to main content

一个用于与 Vika 维格表 API 交互的 Python 库。

Project description

Vika for Astrabot

这是基于兼容性更强的依赖项对Vika交互工具库的重构项目,用于与 Vika 维格表(apitable.com)的 API 进行交互。

Installation

通过 pip 可以轻松安装本库:

pip install astral_vika

Usage

本项目重构过程严格遵守Vika官方文档的操作指引,目标是与原Vika库完全兼容 以下是一个基本的使用示例,展示了如何初始化客户端、获取数据表以及查询记录:

from astral_vika import Vika

# 1. 初始化 Vika 客户端
# 建议从环境变量或安全配置中读取 API Token
vika = Vika(token="YOUR_API_TOKEN")

# 2. 获取指定的数据表
# 可以通过数据表 URL 或 ID 获取
datasheet = vika.datasheet("dstxxxxxxxxxxxxxx") # 替换为你的数据表ID

# 3. 查询所有记录
# records 是一个 Record 对象的列表
try:
    records = datasheet.records.all()
    for record in records:
        # 假设你的表中有“标题”字段
        print(f"记录ID: {record.id}, 标题: {record.get('标题')}")

except Exception as e:
    print(f"查询记录时出错: {e}")

# 4. 创建一条新记录
try:
    new_record = datasheet.records.create({
        "标题": "这是一条来自 Astrabot 的新记录",
        "备注": "通过 vika-for-astrabot SDK 创建"
    })
    print(f"成功创建记录: {new_record.id}")
except Exception as e:
    print(f"创建记录失败: {e}")

License

本项目根据 MIT License 授权。

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

astral_vika-0.9.1.tar.gz (31.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

astral_vika-0.9.1-py3-none-any.whl (44.8 kB view details)

Uploaded Python 3

File details

Details for the file astral_vika-0.9.1.tar.gz.

File metadata

  • Download URL: astral_vika-0.9.1.tar.gz
  • Upload date:
  • Size: 31.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.10.9

File hashes

Hashes for astral_vika-0.9.1.tar.gz
Algorithm Hash digest
SHA256 8cd4233e07faa5581406ed1a57db3fedcafd36652c1ea7268e0711f47fbf4488
MD5 8c16c26f1b27ecce5b5246e565479167
BLAKE2b-256 227dc602defdd7c85807d34a058239b3ee3d173cc91751f286540f82640c03e0

See more details on using hashes here.

File details

Details for the file astral_vika-0.9.1-py3-none-any.whl.

File metadata

  • Download URL: astral_vika-0.9.1-py3-none-any.whl
  • Upload date:
  • Size: 44.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.10.9

File hashes

Hashes for astral_vika-0.9.1-py3-none-any.whl
Algorithm Hash digest
SHA256 11a30df47fa2ba3b2e306ede479f7dc61e3f099ee6d437a46b2ba3a7837ec9a0
MD5 deaae04f826bc30d3aebe1dc1779cda9
BLAKE2b-256 8dc6e8068bfd45f91dfe9eb448942c87fc28c3780177f94af79d0604592cdf5f

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page