How quantumleap-us/beamable-auto-claim works
Main Components
• Auto Claim Controller (auto_claim.py): The core script that triggers claim operations immediately and schedules subsequent claims.
• Configuration Management: The .env file (copied from .env.example) holds the BEAMABLE_COOKIE, which is critical for authenticated requests.
• HTTP Client Module: Uses Python HTTP requests (likely the “requests” library) to fetch webpage content and parse the countdown information.
• Scheduler Module: Contains logic to compute and schedule the next claim time (defaulting to 12 hours or based on parsed countdown).
• Logging Module: Implements detailed logging (both to the console and an “auto_claim.log” file) with UTC timestamps.
• Startup Script: “start.bat” provides a Windows-friendly mechanism to launch the auto_claim.py script.
Relationships and Interactions
• The Configuration Management component loads environment variables (BEAMABLE_COOKIE) at startup.
• The HTTP Client communicates with the Beamable Network website to retrieve live countdown data.
• The Auto Claim Controller integrates countdown parsing and claim triggering, then passes scheduling information to the Scheduler.
• The Scheduler directs when the next HTTP re-check and claim operation should occur.
• The Logging Module captures all key events and errors, and both console and file outputs are updated accordingly.
Architectural Patterns and Principles
• Fallback mechanism: In case the countdown can’t be parsed, a default interval (12 hours) is applied – this is an example of graceful handling of unexpected data.
• Time-centric design: The use of UTC across logging, scheduling, and operational logic ensures synchronization with the Beamable Network's countdown.
Relevant Technologies & Libraries
• Python 3.7+ as the programming language and runtime.
• External libraries from “requirements.txt” (e.g., requests or any scheduling libraries).
• Environment variable management (with the .env configuration).
• Logging frameworks (likely Python’s built-in logging) for both file and console outputs.