Loading...
Loading...
Compare original and translation side by side
~/.config/twitter/credentials.jsonexport TWITTER_API_KEY="your-api-key"
export TWITTER_API_SECRET="your-api-secret"
export TWITTER_ACCESS_TOKEN="your-access-token"
export TWITTER_ACCESS_SECRET="your-access-secret"
export TWITTER_BEARER_TOKEN="your-bearer-token" # For read-only operationsmkdir -p ~/.config/twitter
cat > ~/.config/twitter/credentials.json << 'EOF'
{
"api_key": "your-api-key",
"api_secret": "your-api-secret",
"access_token": "your-access-token",
"access_secret": "your-access-secret",
"bearer_token": "your-bearer-token"
}
EOF
chmod 600 ~/.config/twitter/credentials.json~/.config/twitter/credentials.jsonexport TWITTER_API_KEY="your-api-key"
export TWITTER_API_SECRET="your-api-secret"
export TWITTER_ACCESS_TOKEN="your-access-token"
export TWITTER_ACCESS_SECRET="your-access-secret"
export TWITTER_BEARER_TOKEN="your-bearer-token" # 用于只读操作mkdir -p ~/.config/twitter
cat > ~/.config/twitter/credentials.json << 'EOF'
{
"api_key": "your-api-key",
"api_secret": "your-api-secret",
"access_token": "your-access-token",
"access_secret": "your-access-secret",
"bearer_token": "your-bearer-token"
}
EOF
chmod 600 ~/.config/twitter/credentials.jsonpip install tweepypip install tweepy| Task | Command |
|---|---|
| Post tweet | |
| Post with image | |
| Reply | |
| Thread | |
| Get timeline | |
| Get mentions | |
| Get DMs | |
| Send DM | |
| Search | |
| User info | |
| Tweet info | |
| Analytics | |
| 任务 | 命令 |
|---|---|
| 发布推文 | |
| 带图发布 | |
| 回复推文 | |
| 发布推文串 | |
| 获取时间线 | |
| 获取提及通知 | |
| 获取私信 | |
| 发送私信 | |
| 搜索 | |
| 获取用户信息 | |
| 获取推文信息 | |
| 查看分析数据 | |
--help{baseDir}/scripts/tweet.py --help
{baseDir}/scripts/tweet.py post --help--help{baseDir}/scripts/tweet.py --help
{baseDir}/scripts/tweet.py post --help{baseDir}/scripts/tweet.py post "Hello, world!"{baseDir}/scripts/tweet.py post "Check this out!" --media photo.png
{baseDir}/scripts/tweet.py post "Multiple images" --media img1.png --media img2.png{baseDir}/scripts/tweet.py reply 1234567890 "Great point!"{baseDir}/scripts/tweet.py thread \
"First tweet in thread" \
"Second tweet" \
"Third tweet"{baseDir}/scripts/tweet.py mentions --count 50{baseDir}/scripts/tweet.py search "openclaw agent" --count 20
{baseDir}/scripts/tweet.py search "#AI lang:en" --count 20{baseDir}/scripts/tweet.py user elonmusk{baseDir}/scripts/tweet.py dm username "Hello from OpenClaw!"{baseDir}/scripts/tweet.py analytics 1234567890{baseDir}/scripts/tweet.py post "Hello, world!"{baseDir}/scripts/tweet.py post "Check this out!" --media photo.png
{baseDir}/scripts/tweet.py post "Multiple images" --media img1.png --media img2.png{baseDir}/scripts/tweet.py reply 1234567890 "Great point!"{baseDir}/scripts/tweet.py thread \
"First tweet in thread" \
"Second tweet" \
"Third tweet"{baseDir}/scripts/tweet.py mentions --count 50{baseDir}/scripts/tweet.py search "openclaw agent" --count 20
{baseDir}/scripts/tweet.py search "#AI lang:en" --count 20{baseDir}/scripts/tweet.py user elonmusk{baseDir}/scripts/tweet.py dm username "Hello from OpenClaw!"{baseDir}/scripts/tweet.py analytics 1234567890| Tier | Cost | Read | Write | Search |
|---|---|---|---|---|
| Free | $0 | Limited | - | - |
| Basic | $100/mo | 10k/mo | 1.5k/mo | 50/mo |
| Pro | $5000/mo | 1M/mo | 300k/mo | 500/mo |
{baseDir}/references/api-limits.md| 层级 | 费用 | 读取额度 | 写入额度 | 搜索额度 |
|---|---|---|---|---|
| 免费版 | $0 | 有限额度 | - | - |
| 基础版 | $100/月 | 1万次/月 | 1500次/月 | 50次/月 |
| 专业版 | $5000/月 | 100万次/月 | 30万次/月 | 500次/月 |
{baseDir}/references/api-limits.md| Error | Cause | Solution |
|---|---|---|
| 403 Forbidden | Insufficient tier | Upgrade API tier or check endpoint access |
| 429 Too Many Requests | Rate limit hit | Wait and retry; check rate limit headers |
| 401 Unauthorized | Invalid credentials | Verify API keys and tokens |
| 404 Not Found | Tweet/user deleted | Handle gracefully, inform user |
| 422 Unprocessable | Duplicate tweet | Wait before posting same content |
| 错误 | 原因 | 解决方案 |
|---|---|---|
| 403 禁止访问 | 层级权限不足 | 升级API层级或检查端点访问权限 |
| 429 请求过多 | 达到速率限制 | 等待后重试,检查速率限制响应头 |
| 401 未授权 | 凭证无效 | 验证API密钥和令牌是否正确 |
| 404 未找到 | 推文/用户已删除 | 优雅处理异常,告知用户 |
| 422 无法处理请求 | 推文内容重复 | 间隔一段时间后再发布相同内容 |
{baseDir}/references/search-operators.md{baseDir}/references/search-operators.md{baseDir}/scripts/tweet.py{baseDir}/references/api-limits.md{baseDir}/references/search-operators.md{baseDir}/scripts/tweet.py{baseDir}/references/api-limits.md{baseDir}/references/search-operators.md