算法艺术创作
algorithmic-art
通过代码和可调参数创作生成艺术与交互式视觉效果。
brightdata-sdk-patterns【设计与创意】Wrap the official Bright Data Python SDK and REST contracts behind a typed, testable client boundary. Use when adding SDK calls, isolating provider upgrades, or normalizing scraper and Browser API results. Trigger with: "wrap the Bright Data SDK", "design a Bright Data client", "pin Bright Data Python dependencies".
独立 GitHub 快照 · 自动分类 · 以原作者文档为准
name: brightdata-sdk-patterns description: 'Wrap the official Bright Data Python SDK and REST contracts behind a typed, testable client boundary. Use when adding SDK calls, isolating provider upgrades, or normalizing scraper and Browser API results. Trigger with: "wrap the Bright Data SDK", "design a Bright Data client", "pin Bright Data Python dependencies".' allowed-tools: Read, Grep, Write, Edit, Bash(python:*) version: 2.0.0 argument-hint: "[client-module]" model: inherit effort: high license: MIT author: Jeremy Longshore jeremy@intentsolutions.io tags:
Use the official Python SDK where it matches the workload, but keep product choice, authorization, retry policy, and domain schemas outside vendor objects. Pin the dependency and expose a small application-owned interface.
Read the lockfile and Grep for direct Bright Data imports. Pin the reviewed SDK release through the repository dependency workflow rather than embedding a version in this skill.
Write an application interface that returns normalized records and provider receipts, not raw SDK response objects.
from dataclasses import dataclass
@dataclass(frozen=True)
class CollectionReceipt:
operation_id: str
state: str
records: int | None
provider_code: str | None
Keep API-key, proxy-zone, and Browser API adapters separate. Map documented terminal states and current x-brd-* errors into stable application failure classes.
Use Bash(python:*) to run type checks and fixture tests. Compare the locked SDK behavior with the current official SDK docs before any upgrade.
Use Read and Grep to locate dependency and transport boundaries. Use Write and Edit for the typed port, provider adapters, and tests. Use Bash(python:*) only for local type/test commands; live SDK calls require a separate authorized workflow.
Expose trigger_collection, get_progress, and download_snapshot through your own protocol. Keep a vendor response fixture at the boundary, map it once, and let downstream code depend only on CollectionReceipt.
| Failure | Meaning | Response |
|---|---|---|
| SDK object escapes the adapter | Provider coupling reaches domain code | Normalize the response at the boundary |
| Upgrade changes a field or state | Lockfile moved without contract review | Hold the upgrade and refresh fixtures from documentation |
| Client selects a product implicitly | Policy and cost behavior become hidden | Require an explicit product configuration |