Skip to main content
Glama
moon_phase_demo.py1.13 kB
import sys import os from datetime import datetime, timedelta import pytz # Add project root to python path so we can import src # Assuming this script is run from the project root or examples/ directory project_root = os.path.abspath(os.path.join(os.path.dirname(__file__), '..')) if project_root not in sys.path: sys.path.insert(0, project_root) from src.celestial import calculate_moon_info def main(): print("Moon Phase Demo") print("===============") # Use current time in UTC start_date = datetime.now(pytz.UTC) print(f"Calculating moon phases for the next 30 days starting from {start_date.date()}...\n") print(f"{'Date':<12} | {'Phase':<16} | {'Illum %':<8} | {'Age (days)':<10}") print("-" * 55) for i in range(0, 30): date = start_date + timedelta(days=i) info = calculate_moon_info(date) phase = info['phase_name'] illum = info['illumination'] * 100 age = info['age_days'] print(f"{date.strftime('%Y-%m-%d'):<12} | {phase:<16} | {illum:8.1f} | {age:10.1f}") if __name__ == "__main__": main()

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/StarGazer1995/mcp-stargazing'

If you have feedback or need assistance with the MCP directory API, please join our Discord server