返回顶部
a

apify-keysApify密钥管理器

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
安全检测
已通过
82
下载量
免费
免费
0
收藏
概述
安装方式
版本历史

apify-keys

Apify 密钥轮换器

从 ColdCore 数据库中获取轮换的 Apify API 密钥。密钥按最近最少使用原则进行轮换,并附带余额检查。

使用方法

获取下一个可用的 API 密钥:
bash
python3 ~/.openclaw/workspace/skills/apify-keys/scripts/get_key.py

以 JSON 格式获取密钥(用于传递给其他脚本):
bash
python3 ~/.openclaw/workspace/skills/apify-keys/scripts/get_key.py --json

检查特定密钥的余额:
bash
python3 ~/.openclaw/workspace/skills/apify-keys/scripts/getkey.py --check-balance --key apifyapi_xxxxx

列出所有可用密钥及其余额:
bash
python3 ~/.openclaw/workspace/skills/apify-keys/scripts/get_key.py --list

工作原理

  1. 1. 连接到 ColdCore MySQL 数据库
  2. 查询 scrapesmaccounts 表中活跃的 Apify 账户
  3. 返回 lastused 时间戳最旧的账户(最近最少使用)
  4. 选择后将 lastused 更新为当前时间戳
  5. 跳过余额为零的账户

环境变量

脚本从以下环境变量读取数据库凭据(如未设置则使用默认值):

  • - COLDCOREHOST — MySQL 主机
  • COLDCOREUSER — MySQL 用户名
  • COLDCOREPASS — MySQL 密码
  • COLDCOREDB — 数据库名称(默认:lead_generator)

输出

默认模式: 仅打印 API 密钥字符串(便于管道传递)

apifyapixxxxx

JSON 模式(--json):
json
{id: 68, apikey: apifyapi_xxxxx, email: user@example.com, balance: 4.95}

与其他技能的集成

其他需要 Apify 访问权限的技能应调用此脚本来获取密钥:

bash
APIFYKEY=$(python3 ~/.openclaw/workspace/skills/apify-keys/scripts/getkey.py)

然后在 API 调用中使用 $APIFY_KEY

或者在 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)
apikey = keydata[api_key]

标签

skill ai

通过对话安装

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

OpenClaw WorkBuddy QClaw Kimi Claude

方式一:安装 SkillHub 和技能

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

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

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

通过命令行安装

skillhub install apify-keys-1776058321

下载

⬇ 下载 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
返回顶部