# mercapi-shops
Async client for **mercari-shops.com** (enterprise sellers on Mercari).
非官方 Mercari Shops(企业商户)GraphQL 异步客户端。
> ✅ 已在生产脚本中验证:支持按店铺 + 关键词抓取、分页、可选在库筛选、客户端价格排序。
> ⚠️ 需要时可传入站点 cookies(如 `__cf_bm`, `_cfuvid`)。
---
## Installation
**From source (editable):**
```bash
pip install -U pip build
pip install -e .
```
## Quick Start
```bash
import asyncio
from mercapi_shops import MercapiShops
async def main():
# 可选:传入 cookies(如 Cloudflare `__cf_bm`, `_cfuvid`)
cookies = {
# "__cf_bm": "...",
# "_cfuvid": "..."
}
api = MercapiShops(cookies=cookies)
# 关键词搜索(按店内搜索),支持 in_stock 与 order_by(客户端价格排序)
res = await api.search(
"アゾン",
shop_id="d2uUKgmbjTGT7BzBGUnXxe",
in_stock=True, # True: 販売中のみ, False: 売り切れのみ, None: 全て
order_by="CREATED_AT" # "PRICE_ASC" / "PRICE_DESC" / "CREATED_AT"(交由后端默认)
)
print("count:", len(res.items))
for p in res.items[:5]:
first_img = p.assets[0].imageUrl if p.assets else ""
print(p.id, p.name, p.price, p.inStock, first_img)
# 分页
if res.pageInfo.hasNextPage:
res2 = await res.next_page()
print("next page count:", len(res2.items))
asyncio.run(main())
```
Raw data
{
"_id": null,
"home_page": null,
"name": "mercapi-shops",
"maintainer": null,
"docs_url": null,
"requires_python": ">=3.9",
"maintainer_email": null,
"keywords": "mercari, mercari-shops, graphql, async, httpx",
"author": "EricMeteorite",
"author_email": null,
"download_url": "https://files.pythonhosted.org/packages/e8/5f/4446b8be18e00923516f21275112de769f685dbe2beabef934f27a2ddff2/mercapi_shops-0.0.1.tar.gz",
"platform": null,
"description": "# mercapi-shops\r\n\r\nAsync client for **mercari-shops.com** (enterprise sellers on Mercari). \r\n\u975e\u5b98\u65b9 Mercari Shops\uff08\u4f01\u4e1a\u5546\u6237\uff09GraphQL \u5f02\u6b65\u5ba2\u6237\u7aef\u3002\r\n\r\n> \u2705 \u5df2\u5728\u751f\u4ea7\u811a\u672c\u4e2d\u9a8c\u8bc1\uff1a\u652f\u6301\u6309\u5e97\u94fa + \u5173\u952e\u8bcd\u6293\u53d6\u3001\u5206\u9875\u3001\u53ef\u9009\u5728\u5e93\u7b5b\u9009\u3001\u5ba2\u6237\u7aef\u4ef7\u683c\u6392\u5e8f\u3002 \r\n> \u26a0\ufe0f \u9700\u8981\u65f6\u53ef\u4f20\u5165\u7ad9\u70b9 cookies\uff08\u5982 `__cf_bm`, `_cfuvid`\uff09\u3002\r\n\r\n---\r\n\r\n## Installation\r\n\r\n**From source (editable):**\r\n```bash\r\npip install -U pip build\r\npip install -e .\r\n```\r\n## Quick Start\r\n```bash\r\nimport asyncio\r\nfrom mercapi_shops import MercapiShops\r\n\r\nasync def main():\r\n # \u53ef\u9009\uff1a\u4f20\u5165 cookies\uff08\u5982 Cloudflare `__cf_bm`, `_cfuvid`\uff09\r\n cookies = {\r\n # \"__cf_bm\": \"...\",\r\n # \"_cfuvid\": \"...\"\r\n }\r\n\r\n api = MercapiShops(cookies=cookies)\r\n # \u5173\u952e\u8bcd\u641c\u7d22\uff08\u6309\u5e97\u5185\u641c\u7d22\uff09\uff0c\u652f\u6301 in_stock \u4e0e order_by\uff08\u5ba2\u6237\u7aef\u4ef7\u683c\u6392\u5e8f\uff09\r\n res = await api.search(\r\n \"\u30a2\u30be\u30f3\",\r\n shop_id=\"d2uUKgmbjTGT7BzBGUnXxe\",\r\n in_stock=True, # True: \u8ca9\u58f2\u4e2d\u306e\u307f, False: \u58f2\u308a\u5207\u308c\u306e\u307f, None: \u5168\u3066\r\n order_by=\"CREATED_AT\" # \"PRICE_ASC\" / \"PRICE_DESC\" / \"CREATED_AT\"(\u4ea4\u7531\u540e\u7aef\u9ed8\u8ba4)\r\n )\r\n\r\n print(\"count:\", len(res.items))\r\n for p in res.items[:5]:\r\n first_img = p.assets[0].imageUrl if p.assets else \"\"\r\n print(p.id, p.name, p.price, p.inStock, first_img)\r\n\r\n # \u5206\u9875\r\n if res.pageInfo.hasNextPage:\r\n res2 = await res.next_page()\r\n print(\"next page count:\", len(res2.items))\r\n\r\nasyncio.run(main())\r\n\r\n```\r\n",
"bugtrack_url": null,
"license": null,
"summary": "Unofficial Mercari-Shops (mercari-shops.com) async client",
"version": "0.0.1",
"project_urls": null,
"split_keywords": [
"mercari",
" mercari-shops",
" graphql",
" async",
" httpx"
],
"urls": [
{
"comment_text": null,
"digests": {
"blake2b_256": "fbbb6b32cad9554fc93d84978528adb09941d6c0168187c68fd82638e186141a",
"md5": "59324c495f159c69e5864c605d987684",
"sha256": "5c017133cd6ca283f478c7b33a01d44349cb7a3ad27100c68a8f740dd357637b"
},
"downloads": -1,
"filename": "mercapi_shops-0.0.1-py3-none-any.whl",
"has_sig": false,
"md5_digest": "59324c495f159c69e5864c605d987684",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.9",
"size": 8088,
"upload_time": "2025-07-28T17:29:34",
"upload_time_iso_8601": "2025-07-28T17:29:34.830702Z",
"url": "https://files.pythonhosted.org/packages/fb/bb/6b32cad9554fc93d84978528adb09941d6c0168187c68fd82638e186141a/mercapi_shops-0.0.1-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": null,
"digests": {
"blake2b_256": "e85f4446b8be18e00923516f21275112de769f685dbe2beabef934f27a2ddff2",
"md5": "8a5c3c9146f319454118e0496a0eea81",
"sha256": "7a15037910da73371373087a3fdb3759da4da3259eb3222883dff3a318cb9848"
},
"downloads": -1,
"filename": "mercapi_shops-0.0.1.tar.gz",
"has_sig": false,
"md5_digest": "8a5c3c9146f319454118e0496a0eea81",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.9",
"size": 7440,
"upload_time": "2025-07-28T17:29:36",
"upload_time_iso_8601": "2025-07-28T17:29:36.098051Z",
"url": "https://files.pythonhosted.org/packages/e8/5f/4446b8be18e00923516f21275112de769f685dbe2beabef934f27a2ddff2/mercapi_shops-0.0.1.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2025-07-28 17:29:36",
"github": false,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"lcname": "mercapi-shops"
}