GraafG/action-store-api

GitHub: GraafG/action-store-api

一款针对 Action 折扣商店 API 的非官方 Python 客户端,解决多国收据、商品与商店数据获取与自动分页问题。

Stars: 0 | Forks: 0

# action-store Action 折扣商店的非官方 Python 客户端。 反向工程自 Android 应用程序。涵盖收据、产品、商店、收藏夹等功能 — 覆盖 Action 运营的 **15 个国家**。 [![CI](https://static.pigsec.cn/wp-content/uploads/repos/2026/04/4df0cfb802140509.svg)](https://github.com/GraafG/action-store-api/actions/workflows/ci.yml) [![Python 3.10+](https://img.shields.io/badge/python-3.10+-e63e11.svg)](https://www.python.org) [![License: MIT](https://img.shields.io/badge/license-MIT-green.svg)](LICENSE) ## 安装 ``` pip install -e . ``` 设置你的 Action 账户凭据: ``` export ACTION_EMAIL="your@email.com" export ACTION_PASSWORD="your_password" ``` ## 快速开始 ``` from action_api import ActionClient client = ActionClient() client.login("your@email.com", "your_password") # 您的个人资料 user = client.get_current_user() print(user["firstName"]) # 所有数字收据(自动分页) receipts = client.get_all_receipts() # 搜索商品 — 按价格排序,分页 results = client.search_products("airfryer", sort_by="PRICE_DESC") for product in results["products"]: print(product["description"], product["price"]["current"]["formatted"]) # 查找城市附近的商店 stores = client.search_stores("Amsterdam") # 每周优惠与传单 PDF deals = client.get_weekdeals() leaflets = client.get_leaflet_urls() # 您的收藏列表 favorites = client.get_favorite_lists() # 任意 GraphQL data = client.execute_raw("query { currentUser { email } }") ``` ## 国家 Action 在 **15 个国家** 运营。设置区域设置以获取本地化内容: ``` client = ActionClient(locale="de-DE") # Germany client = ActionClient(locale="fr-FR") # France client = ActionClient(locale="pl-PL") # Poland ``` | 区域设置 | 国家 | 货币 | Leaflet | |---|---|---|---| | `nl-NL` | 🇳🇱 荷兰 | EUR | nl.publications.action.com | | `de-DE` | 🇩🇪 德国 | EUR | de.publications.action.com | | `fr-FR` | 🇫🇷 法国 | EUR | fr.publications.action.com | | `nl-BE` | 🇧🇪 比利时(荷兰语) | EUR | be.publications.action.com | | `fr-BE` | 🇧🇪 比利时(法语) | EUR | bewa.publications.action.com | | `de-AT` | 🇦🇹 奥地利 | EUR | at.publications.action.com | | `pl-PL` | 🇵🇱 波兰 | EUR | pl.publications.action.com | | `es-ES` | 🇪🇸 西班牙 | EUR | es.publications.action.com | | `it-IT` | 🇮🇹 意大利 | EUR | it.publications.action.com | | `pt-PT` | 🇵🇹 葡萄牙 | EUR | pt.publications.action.com | | `cs-CZ` | 🇨🇿 捷克共和国 | EUR | cz.publications.action.com | | `sk-SK` | 🇸🇰 斯洛伐克 | EUR | — | | `hr-HR` | 🇭🇷 克罗地亚 | EUR | — | | `ro-RO` | 🇷🇴 罗马尼亚 | EUR | — | | `de-CH` | 🇨🇭 瑞士(德语) | CHF | — | | `fr-CH` | 🇨🇭 瑞士(法语) | CHF | — | | `fr-LU` | 🇱🇺 卢森堡 | EUR | — | 所有国家的 API 端点相同 — 仅 `Accept-Language` 请求头会变化。 ## GraphQL 探索器 用于探索 API 的交互式网页端 playground: ``` pip install flask # or: pip install -e ".[explorer]" python explorer.py ``` 打开 http://127.0.0.1:5000 — 登录,从侧边栏选择查询,点击 **运行**(或按 Ctrl+Enter)。 ## API 参考 ### 认证 | 方法 | 描述 | |---|---| | `login(email, password)` | 登录 → 自动存储令牌 | | `refresh_token()` | 刷新过期令牌(自动在 401 时刷新) | | `forgot_password(email)` | 发送密码重置邮件 | | `change_password(current, new)` | 修改密码 | | `delete_account()` | 永久删除账户 | ### 账户 | 方法 | 描述 | |---|---| | `get_current_user()` | 获取资料:姓名、邮箱、出生日期、忠诚卡 | | `update_user_data(first, last, dob)` | 更新姓名/出生日期 | | `get_preferences()` | 新闻通讯/营销偏好 | | `update_preferences(**kwargs)` | 更新偏好 | | `get_customer_interests()` | 个人兴趣 | | `save_customer_interests(items)` | 更新兴趣 | ### 收据 | 方法 | 描述 | |---|---| | `get_receipts(offset=None)` | 一页收据 | | `get_all_receipts()` | 所有收据(自动分页) | | `get_receipt(id)` | 完整收据:产品、增值税、条形码 | ### 产品 | 方法 | 描述 | |---|---| | `search_products(term, sort_by, page)` | 搜索。排序:`PRICE_ASC`、`PRICE_DESC` 或 `None` | | `search_with_suggestions(term)` | 自动补全搜索 | | `get_product(code)` | 通过商品编码获取产品 | | `get_product_by_ean(ean)` | 通过 EAN 条形码获取产品 | | `get_products_by_codes(codes)` | 批量查询 | | `get_related_products(code)` | 相关产品 | ### 收藏夹 | 方法 | 描述 | |---|---| | `get_favorite_lists()` | 所有列表 | | `get_favorite_list_items(id)` | 列表中的产品 | | `rename_favorite_list(id, name, created_at)` | 重命名 | | `update_favorite_list_items(id, products)` | 添加/移除产品 | | `delete_favorite_list(id)` | 删除 | | `share_favorite_list(id)` | 分享 → 返回共享 ID | ### 商店 | 方法 | 描述 | |---|---| | `search_stores(query)` | 按位置搜索 | | `get_store(id)` | 商店详情 | | `get_place_suggestions(query)` | 地点自动补全 | ### 内容 | 方法 | 描述 | |---|---| | `get_weekdeals(week_offset=0)` | 每周促销 | | `get_leaflet_urls()` | 文件夹/Leaflet PDF URL | | `get_category_menu()` | 完整分类树 | | `get_new_products_page()` | 新产品 | ### 忠诚度游戏 | 方法 | 描述 | |---|---| | `get_active_campaign(game_type)` | 活动中的活动 | | `get_tickets(game_type)` | 你的门票 | | `get_participate_question(game_type)` | 问答题目 | ### 通知 | 方法 | 描述 | |---|---| | `register_device(token)` | 注册推送通知 | | `get_subscriptions(token)` | 当前订阅 | | `subscribe(name, token)` | 订阅主题 | | `unsubscribe(name, token)` | 取消订阅 | ## 配置 ``` client = ActionClient( locale="nl-NL", # Country locale (default: nl-NL) timeout=30, # Request timeout in seconds max_retries=3, # Retries on rate limit (429) backoff_factor=2, # Exponential backoff base ) ``` ## 示例 参见 [`examples/`](examples/) — 收据、产品搜索、商店、收藏夹、每周促销。 ## 技术细节 | | | |---|---| | **端点** | `https://gateway.action.com/api/gateway` | | **协议** | GraphQL(Apollo Server) | | **认证** | 邮箱/密码 → JWT(访问令牌 + 刷新令牌) | | **速率限制** | ~10 请求/秒 — 自动重试并使用指数退避 | | **自动刷新** | 在 401 时透明刷新过期令牌 | ## 免责声明 这是一个非官方项目。与 Action 无关。请自行承担使用风险。
标签:15个国家, Android逆向, API客户端, CI, GitHub Actions, GraphQL, Python 3.10, Python客户端, REST API, 云资产清单, 产品查询, 优惠券, 促销, 多国支持, 开源, 折扣商店, 收据, 收藏夹, 本地化, 自动笔记, 逆向工具, 逆向工程, 门店定位