亚马逊订单:程序化访问订单历史记录 - Openclaw Skills
作者:互联网
2026-04-06
什么是 亚马逊订单技能?
亚马逊订单技能使开发人员和高级用户能够在不需要官方 API 的情况下与其 Amazon.com 订单历史记录进行交互。通过利用 amazon-orders Python 软件包,此技能可以抓取并解析亚马逊消费者网站,以检索详细的交易记录。对于任何使用 Openclaw Skills 构建个人财务追踪器、库存系统或自动化费用报告的人来说,这是一个至关重要的组件。
该技能支持 Amazon.com 的英文版本,并提供了一种无缝的方式将基于 Web 的消费者数据与本地开发环境桥接。无论您是寻找 Python 库的开发人员还是需要 CLI 工具的系统管理员,此技能都提供了灵活处理复杂订单数据的能力。
下载入口:https://github.com/openclaw/skills/tree/main/skills/pfernandez98/amazon-orders
安装与下载
1. ClawHub CLI
从源直接安装技能的最快方式。
npx clawhub@latest install amazon-orders
2. 手动安装
将技能文件夹复制到以下位置之一
全局模式~/.openclaw/skills/
工作区
/skills/
优先级:工作区 > 本地 > 内置
3. 提示词安装
将此提示词复制到 OpenClaw 即可自动安装。
请帮我使用 Clawhub 安装 amazon-orders。如果尚未安装 Clawhub,请先安装(npm i -g clawhub)。
亚马逊订单技能 应用场景
- 将年度购买历史记录导出为 JSON,用于报税或预算编制。
- 自动化获取过去 30 天内的业务支出。
- 通过程序化数据分析监控个人消费习惯。
- 将亚马逊订单元数据集成到自定义数据库或生产力仪表板中。
- 技能使用您的账户凭据或环境变量初始化 AmazonSession。
- 如果启用了 MFA,它将使用提供的 OTP 密钥生成基于时间的一次性密码。
- 它与 Amazon.com 进行身份验证并维持会话以检索数据。
- AmazonOrders 类解析订单历史页面的 HTML 以提取结构化数据。
- 用户可以指定时间过滤器或请求完整详情,以增加返回信息的深度。
亚马逊订单技能 配置指南
要使用 Openclaw Skills 将此集成到您的环境中,请先安装该软件包:
python3 -m pip install --upgrade amazon-orders
接下来,配置您的身份验证凭据。出于安全考虑,推荐使用环境变量:
export AMAZON_USERNAME="you@example.com"
export AMAZON_PASSWORD="your-password"
# 自动化推荐使用
export AMAZON_OTP_SECRET_KEY="BASE32_TOTP_SECRET"
亚马逊订单技能 数据架构与分类体系
该技能返回可作为 JSON 输出的结构化数据。以下是查询订单历史记录时的主要可用字段:
| 字段 | 描述 |
|---|---|
| order_number | 亚马逊订单的唯一字母数字标识符。 |
| grand_total | 订单总费用,包括税费和运费。 |
| order_date | 下单日期。 |
| items | 订单中的特定产品列表(需要 full_details)。 |
| status | 订单的当前配送或处理状态。 |
name: amazon-orders
description: Download and query your Amazon order history via an unofficial Python API and CLI.
homepage: https://github.com/alexdlaird/amazon-orders
metadata: {"clawdbot":{"emoji":"??","requires":{"bins":["python3","pip3"],"env":["AMAZON_USERNAME", "AMAZON_PASSWORD", "AMAZON_OTP_SECRET_KEY"]}}}
amazon-orders Skill
Interact with your Amazon.com order history using the unofficial amazon-orders Python package and CLI.
Note:
amazon-ordersworks by scraping/parsing Amazon's consumer website, so it can break if Amazon changes their pages. Only the English Amazon .com site is officially supported.
Setup
Install / upgrade
python3 -m pip install --upgrade amazon-orders
(Install details and version pinning guidance are in the project README.)
Authentication options
amazon-orders can get credentials from (highest precedence first): environment variables, parameters passed to AmazonSession, or a local config.
Environment variables:
export AMAZON_USERNAME="you@example.com"
export AMAZON_PASSWORD="your-password"
# Optional: for accounts with OTP/TOTP enabled
export AMAZON_OTP_SECRET_KEY="BASE32_TOTP_SECRET"
(OTP secret key usage is documented by the project.)
Usage
You can use amazon-orders either as a Python library or from the command line.
Python: basic usage
from amazonorders.session import AmazonSession
from amazonorders.orders import AmazonOrders
amazon_session = AmazonSession("", "")
amazon_session.login()
amazon_orders = AmazonOrders(amazon_session)
# Orders from a specific year
orders = amazon_orders.get_order_history(year=2023)
# Or use a time filter for recent orders
orders = amazon_orders.get_order_history(time_filter="last30") # Last 30 days
orders = amazon_orders.get_order_history(time_filter="months-3") # Past 3 months
for order in orders:
print(f"{order.order_number} - {order.grand_total}")
Full details (slower, more fields)
Some order fields only populate when you request full details; enable it when you need richer order data:
- Python:
full_details=True - CLI:
--full-detailsonhistory
CLI: common commands
# Authenticate (interactive / uses env vars if set)
amazon-orders login
# Order history
amazon-orders history --year 2023
amazon-orders history --last-30-days
amazon-orders history --last-3-months
Tips
- If your account has MFA enabled, prefer setting
AMAZON_OTP_SECRET_KEYfor automated runs. - When automating, keep credentials out of shell history: use environment variables and a secret manager (1Password, Vault, GitHub Actions secrets, etc.).
Examples
Export yearly history to JSON
amazon-orders history --year 2023 --full-details > orders_2023.json
Quick totals check (requires jq)
amazon-orders history --last-30-days --full-details | jq -r '.[] | [.order_number, .grand_total] | @tsv'
Notes
- This is an unofficial scraper-based tool (no official Amazon API).
- Official docs are hosted on Read the Docs for advanced usage and APIs (Orders, Transactions, etc.).
相关推荐
专题
+ 收藏
+ 收藏
+ 收藏
+ 收藏
+ 收藏
+ 收藏
最新数据
相关文章
代理状态:监控支付意图和交易 - Openclaw Skills
Proxy MCP:AI 智能体支付与虚拟卡 - Openclaw Skills
Apify Ultimate Scraper: AI 网页数据抓取 - Openclaw Skills
加密诈骗检测器:实时欺诈预防 - Openclaw Skills
newsmcp: 实时 AI 新闻聚合与过滤 - Openclaw Skills
Moltbook 优化器:策略与排名精通 - Openclaw 技能
Frigate NVR:智能摄像机管理与自动化 - Openclaw Skills
Markdown 检查器:样式、链接和格式工具 - Openclaw Skills
Venice.ai 至尊路由:私密且无审查的模型路由 - Openclaw Skills
图片优化器:使用 Openclaw Skills 压缩和调整图片尺寸
AI精选
