Files
lastz-giftcenter-cli/CLAUDE.md
2026-03-20 00:43:56 +08:00

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:

  • logincmd_login() — GET /getcodeuser.php?uid=..., displays account info
  • redeem <code>cmd_redeem() — GET /code.php with Usertoken header and uid/code params

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.