1.1 KiB
1.1 KiB
CLAUDE.md
This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
Commands
# Install dependencies
pip install -r requirements.txt
# Run the CLI
python giftcenter.py login
python giftcenter.py redeem <gift_code>
# Override UID without editing .env
python giftcenter.py --uid <uid> login
python giftcenter.py --uid <uid> redeem <gift_code>
Configuration
UID is read from the UID environment variable, typically set in .env. The --uid flag on any subcommand overrides it.
Architecture
Single-file Python CLI (giftcenter.py) using argparse subcommands:
login→cmd_login()— GET/getcodeuser.php?uid=..., displays account inforedeem <code>→cmd_redeem()— GET/code.phpwithUsertokenheader anduid/codeparams
API responses use numeric error codes (code field) for login and string error codes (errorCode field, value "ok" on success) for redemption. Error mappings are in LOGIN_ERRORS and REDEEM_ERRORS constants. UI text is in Traditional Chinese.