iAEON authentication, digital receipt retrieval, and food inventory management toolkit
Project description
iaeon
iAEON アプリの認証・電子レシート取得・食料在庫管理を行う Python ツールキット。
インストール
pip install iaeon
# レシート画像レンダリングが必要な場合
pip install iaeon[image]
日本語フォント (NotoSansCJK) がシステムにインストールされていると、レシート画像が正しくレンダリングされる。
# Debian/Ubuntu
sudo apt install fonts-noto-cjk
セットアップ
1. ログイン
iaeon-login で iAEON アカウントにログインし、アクセストークンを .env に保存する。
# 対話式
iaeon-login
# 引数で指定
iaeon-login --phone 09012345678 --password yourpassword
認証フロー:
- 電話番号 + パスワードでログイン
- SMS認証コードの送信・検証 (新デバイス時)
- アクセストークン取得 →
.envに保存
2. .env ファイル
ACCESS_TOKEN="..."
DEVICE_ID="bf533bf5-..."
RECEIPT_ACCOUNT_ID="..."
GOOGLE_API_KEY=""
GOOGLE_SEARCH_ENGINE_ID=""
RECEIPT_ACCOUNT_IDは電子レシート機能に必要。iAEON アプリの通信から取得する。GOOGLE_API_KEY/GOOGLE_SEARCH_ENGINE_IDは商品情報検索用 (任意)。未設定でもローカルキーワードマッチで動作する。
電子レシート
from iaeon.receipt import IAEONReceiptClient
client = IAEONReceiptClient(
access_token="...",
receipt_account_id="...",
)
# レシート一覧取得 (デフォルト: 今月)
receipts = client.list_receipts()
for r in receipts:
print(f"{r.datetime} {r.store_name} ¥{r.total}")
# レシート詳細取得
detail = client.get_receipt_detail(r.receipt_id)
# 画像として保存
path = client.save_receipt_image(detail, output_dir="receipts")
print(f"保存: {path}")
日付範囲を指定
receipts = client.list_receipts(from_date="20260101", to_date="20260131")
レンダリングオプション
img = IAEONReceiptClient.render_receipt_image(
detail,
font_size=18,
width=580,
padding=20,
bg_color="white",
text_color="black",
)
img.save("receipt.png")
食料在庫管理
レシートから購入した食品を自動パースし、SQLite DB に登録して在庫管理する。
CLI
# レシートから食料をインポート (デフォルト: 今月)
iaeon-inventory import
# 日付範囲を指定
iaeon-inventory import --from-date 20260201 --to-date 20260213
# 在庫一覧
iaeon-inventory stock
# 期限切れ間近の在庫 (デフォルト: 3日以内)
iaeon-inventory expiring
iaeon-inventory expiring --days 7
Python API
from iaeon.inventory import FoodInventoryDB
db = FoodInventoryDB()
# 在庫一覧
items = db.get_in_stock_items()
for item in items:
print(f"{item['name']} x{item['total_quantity']} [{item['category']}]")
# 期限切れ間近
expiring = db.get_expiring_soon(days=3)
# 消費済みにマーク
db.mark_consumed("明治おいしい牛乳", count=1)
db.close()
商品分類
2段階で商品を自動分類する:
- ローカルキーワードマッチ — 商品名から即座に分類 (API不要)
- Google Custom Search API — ローカルで判定できない場合に Web 検索 (要API設定)
API リファレンス
IAEONAuth
| メソッド | 説明 |
|---|---|
full_login(phone, password) |
完全なログインフロー (対話式、SMS入力あり) |
login(phone, password) |
ログイン。SMS認証が必要な場合 code 10021/10008 を返す |
request_sms() |
SMS認証コード送信リクエスト |
verify_sms_code(auth_code) |
SMS認証コード検証 |
login_token() |
Bearer トークン取得 |
get_access_token(client_id?) |
サービス用アクセストークン取得 |
IAEONReceiptClient
| メソッド | 説明 |
|---|---|
list_receipts(from_date?, to_date?) |
レシート一覧を ReceiptSummary のリストで返す |
get_receipt_detail(receipt_id) |
レシート詳細を ReceiptDetail で返す |
get_store_info(store_code) |
店舗情報の dict を返す |
render_receipt_image(detail, ...) |
レシートを PIL.Image にレンダリング (staticmethod) |
save_receipt_image(detail, output_dir, ...) |
レシート画像を PNG で保存 |
save_embedded_images(detail, output_dir) |
埋め込み画像を個別保存 |
FoodInventoryDB
| メソッド | 説明 |
|---|---|
import_receipt(receipt, product_infos?) |
レシート全体を DB にインポート |
get_in_stock_items() |
在庫一覧を返す |
get_expiring_soon(days=3) |
期限切れ間近の在庫を返す |
mark_consumed(product_name, count=1) |
在庫を消費済みにマーク |
ライセンス
MIT
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file iaeon-0.1.0.tar.gz.
File metadata
- Download URL: iaeon-0.1.0.tar.gz
- Upload date:
- Size: 23.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
7ef6e2c2bff5c9140ad1cfa22f9f91ab6d0ff8ea4369b4a56a2ad1ae12e87262
|
|
| MD5 |
7026a2f72b40dcb5f06c4216ddfb1b19
|
|
| BLAKE2b-256 |
6585fbb9123875a84a384dedd6763974866f3f75ecedf2393fbe1ce2aa9f7052
|
Provenance
The following attestation bundles were made for iaeon-0.1.0.tar.gz:
Publisher:
workflow.yml on serkenn/i-AEON-lib
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
iaeon-0.1.0.tar.gz -
Subject digest:
7ef6e2c2bff5c9140ad1cfa22f9f91ab6d0ff8ea4369b4a56a2ad1ae12e87262 - Sigstore transparency entry: 945836867
- Sigstore integration time:
-
Permalink:
serkenn/i-AEON-lib@eacd5f0d24e42d2642c00c4cf6dd934fa360a0d3 -
Branch / Tag:
refs/tags/v1.0.0 - Owner: https://github.com/serkenn
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
workflow.yml@eacd5f0d24e42d2642c00c4cf6dd934fa360a0d3 -
Trigger Event:
release
-
Statement type:
File details
Details for the file iaeon-0.1.0-py3-none-any.whl.
File metadata
- Download URL: iaeon-0.1.0-py3-none-any.whl
- Upload date:
- Size: 28.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
e7d73231f196537b77b8343c5a75f86bd8a9d6081c35c6e66e584572746e0797
|
|
| MD5 |
5242db8d798b117edde6b0ae7c01d90b
|
|
| BLAKE2b-256 |
72c4b220ed7d2e59bb55ad486eb1567e06321ccf7ee20b36a19fe995b75dc2c5
|
Provenance
The following attestation bundles were made for iaeon-0.1.0-py3-none-any.whl:
Publisher:
workflow.yml on serkenn/i-AEON-lib
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
iaeon-0.1.0-py3-none-any.whl -
Subject digest:
e7d73231f196537b77b8343c5a75f86bd8a9d6081c35c6e66e584572746e0797 - Sigstore transparency entry: 945836890
- Sigstore integration time:
-
Permalink:
serkenn/i-AEON-lib@eacd5f0d24e42d2642c00c4cf6dd934fa360a0d3 -
Branch / Tag:
refs/tags/v1.0.0 - Owner: https://github.com/serkenn
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
workflow.yml@eacd5f0d24e42d2642c00c4cf6dd934fa360a0d3 -
Trigger Event:
release
-
Statement type: