返回顶部
a

apify-keys

Rotating Apify API key manager. Returns the least-recently-used active Apify key from the ColdCore database. Use before any Apify API call to get a fresh key with available credits.

作者: admin | 来源: ClawHub
源自
ClawHub
版本
V 1.0.0
安全检测
已通过
69
下载量
0
收藏
概述
安装方式
版本历史

apify-keys

# Apify Key Rotator Get a rotating Apify API key from the ColdCore database. Keys are rotated by least-recently-used with balance checking. ## Usage **Get next available API key:** ```bash python3 ~/.openclaw/workspace/skills/apify-keys/scripts/get_key.py ``` **Get key as JSON (for piping to other scripts):** ```bash python3 ~/.openclaw/workspace/skills/apify-keys/scripts/get_key.py --json ``` **Check balance on a specific key:** ```bash python3 ~/.openclaw/workspace/skills/apify-keys/scripts/get_key.py --check-balance --key "apify_api_xxxxx" ``` **List all available keys with balances:** ```bash python3 ~/.openclaw/workspace/skills/apify-keys/scripts/get_key.py --list ``` ## How It Works 1. Connects to ColdCore MySQL database 2. Queries `scrape_sm_accounts` for active Apify accounts 3. Returns the account with the oldest `last_used` timestamp (least recently used) 4. Updates `last_used` to current timestamp after selection 5. Skips accounts with zero balance ## Environment Variables The script reads database credentials from these environment variables (falls back to defaults): - `COLDCORE_HOST` — MySQL host - `COLDCORE_USER` — MySQL username - `COLDCORE_PASS` — MySQL password - `COLDCORE_DB` — Database name (default: `lead_generator`) ## Output **Default mode:** prints just the API key string (for easy piping) ``` apify_api_xxxxx ``` **JSON mode (`--json`):** ```json {"id": 68, "api_key": "apify_api_xxxxx", "email": "user@example.com", "balance": 4.95} ``` ## Integration with Other Skills Other skills that need Apify access should call this script to get a key: ```bash APIFY_KEY=$(python3 ~/.openclaw/workspace/skills/apify-keys/scripts/get_key.py) # Then use $APIFY_KEY in your API calls ``` Or in Python: ```python import subprocess result = subprocess.run( ["python3", os.path.expanduser("~/.openclaw/workspace/skills/apify-keys/scripts/get_key.py"), "--json"], capture_output=True, text=True ) key_data = json.loads(result.stdout) api_key = key_data["api_key"] ```

标签

skill ai

通过对话安装

该技能支持在以下平台通过对话安装:

OpenClaw WorkBuddy QClaw Kimi Claude

方式一:安装 SkillHub 和技能

帮我安装 SkillHub 和 apify-keys-1776058321 技能

方式二:设置 SkillHub 为优先技能安装源

设置 SkillHub 为我的优先技能安装源,然后帮我安装 apify-keys-1776058321 技能

通过命令行安装

skillhub install apify-keys-1776058321

下载 Zip 包

⬇ 下载 apify-keys v1.0.0

文件大小: 3.65 KB | 发布时间: 2026-4-14 13:07

v1.0.0 最新 2026-4-14 13:07
Initial release of apify-keys skill.

- Provides a rotating Apify API key manager using least-recently-used logic with balance verification.
- Retrieves and updates key usage from the ColdCore MySQL database.
- Offers CLI usage for getting keys, JSON output, checking balances, and listing all available keys.
- Uses environment variables for database configuration with sensible defaults.
- Designed to be easily integrated with other scripts and skills.

Archiver·手机版·闲社网·闲社论坛·羊毛社区· 多链控股集团有限公司 · 苏ICP备2025199260号-1

Powered by Discuz! X5.0   © 2024-2025 闲社网·线报更新论坛·羊毛分享社区·http://xianshe.com

p2p_official_large
返回顶部