vercel

Python SDK for Vercel

31 个版本 Python >=3.10
安装
pip install vercel
poetry add vercel
pipenv install vercel
conda install vercel
描述

Vercel Python SDK

Python SDK for Vercel APIs and Vercel Functions.

For product-level behavior, limits, and platform setup, use the official Vercel docs.

Getting Started

Install the package:

pip install vercel

Or with uv:

uv add vercel

Configure the credentials via environment variables based on your app's needs:

  • BLOB_READ_WRITE_TOKEN for Vercel Blob
  • VERCEL_TOKEN, VERCEL_PROJECT_ID, and VERCEL_TEAM_ID for Vercel API clients
  • VERCEL_OIDC_TOKEN for local OIDC testing. On Vercel, OIDC helpers can read the request token after you register request headers with vercel.headers.set_headers().

For local OIDC development, you can load a short-lived token dynamically with the Vercel CLI:

VERCEL_OIDC_TOKEN=$(vc project token some-project) some-command

Usage

import asyncio

from vercel.client import AsyncVercel
from vercel.oidc.credentials import get_credentials


async def main() -> None:
    credentials = get_credentials()
    vercel = AsyncVercel(access_token=credentials.token)
    deployment = await vercel.deployments.create_deployment(
        body={
            "name": "hello-python",
            "project": "hello-python",
            "target": "preview",
            "files": [
                {
                    "file": "index.html",
                    "data": "<h1>Hello from Python</h1>",
                }
            ],
        }
    )

    print(f"Deployment created: https://{deployment['url']}")


asyncio.run(main())

Public API Vs Internals

Import from public modules under vercel.*, such as vercel.blob, vercel.cache, vercel.headers, vercel.oidc, vercel.projects, and vercel.sandbox. Modules under vercel._internal.* are implementation details and may change without public API guarantees.

Sync counterparts are available for the main client classes and module-level helpers when you are not running an async application.

版本列表
0.5.9 2026-05-19
0.5.8 2026-04-22
0.5.7 2026-04-15
0.5.6 2026-04-13
0.5.5 2026-04-12
0.5.4 2026-04-08
0.5.3 2026-03-27
0.5.2 2026-03-09
0.5.1 2026-02-27
0.5.0 2026-02-19
0.4.0 2026-02-12
0.3.8 2026-01-20
0.3.7 2026-01-08
0.3.6 2025-12-17
0.3.5 2025-10-28
0.3.4 2025-10-22
0.3.3 2025-10-21
0.3.2 2025-10-18
0.3.1 2025-10-18
0.3.0 2025-10-17
0.2.1 2020-07-28
0.2.0 2020-07-28
0.1.8 2020-07-27
0.1.7 2020-07-27
0.1.6 2020-07-27
0.1.5 2020-07-27
0.1.4 2020-07-26
0.1.3 2020-07-26
0.1.2 2020-07-25
0.1.1 2020-07-25
0.1.0 2020-07-25