Update app.py
Browse files9 unmodified lines101112131413141516171819201617181923242526272820212223242526273228293031363738394041424332333435363738394041424348444546474849505556575152535455616256576465585960616263707164657366677568697071807273747576778687887879808192939482838485869887888990919293105949596979 unmodified lines)
COOL_FACTS = [ "Honey never spoils. Archaeologists have found 3000-year-old honey in Egyptian tombs that's still edible.", "A group of flamingos is called a 'flamboyance'.", "Honey never spoils. Archaeologists have found 3000-year-old honey that's still edible.", "A group of flamingos is called a flamboyance.", "Octopuses have three hearts and blue blood.", "Bananas are berries, but strawberries aren't.", "There are more stars in the universe than grains of sand on all Earth's beaches.", "Water can boil and freeze at the same time (triple point).", "A day on Venus is longer than its year.", "Your body produces enough heat in 30 minutes to bring water to a boil." "Bananas are berries, but strawberries are not.", "There are more stars in the universe than grains of sand on all Earth's beaches."]
MOTIVATIONAL_QUOTES = [ "The only way to do great work is to love what you do. - Steve Jobs", "Innovation distinguishes between a leader and a follower. - Steve Jobs", "The future belongs to those who believe in the beauty of their dreams. - Eleanor Roosevelt", "Success is not final, failure is not fatal: it is the courage to continue that counts. - Winston Churchill", "Believe you can and you're halfway there. - Theodore Roosevelt"QUOTES = [ "The only way to do great work is to love what you do.", "Innovation distinguishes between a leader and a follower.", "The future belongs to those who believe in the beauty of their dreams.", "Success is not final, failure is not fatal: courage to continue counts."]
@app.get("/")async def root():def root(): return { "message": "Welcome to The-Chef's Epic API!", "version": "2.0.0", "endpoints": { "/status": "Get system status and info", "/random-fact": "Get a random cool fact", "/motivate": "Get motivated with a quote", "/time": "Get current server time", "/hello/{name}": "Get a personalized greeting", "/docs": "Interactive API documentation" }, "endpoints": [ "/status - Get system status", "/random-fact - Get a cool fact", "/motivate - Get motivated", "/time - Current time", "/hello/{name} - Personalized greeting", "/docs - API documentation" ], "coolness_level": "Over 9000!" }
@app.get("/status")async def get_status():def get_status(): return { "status": "ONLINE", "api_name": "The-Chef's Epic API", "version": "2.0.0", "platform": platform.system(), "python_version": platform.python_version(), "uptime_message": "Running smooth like butter", "endpoints_available": 6, "coolness_level": "Over 9000!" "message": "Running smooth like butter", "coolness_level": "Maximum" }
@app.get("/random-fact")async def random_fact(): fact = random.choice(COOL_FACTS)def random_fact(): return { "fact": fact, "category": "mind = blown", "fact": random.choice(COOL_FACTS), "category": "Mind Blown", "timestamp": datetime.now().isoformat() }
@app.get("/motivate")async def get_motivation(): quote = random.choice(MOTIVATIONAL_QUOTES)def get_motivation(): return { "quote": quote, "quote": random.choice(QUOTES), "message": "You got this!", "vibes": "Positive", "timestamp": datetime.now().isoformat() }
@app.get("/time")async def get_time():def get_time(): now = datetime.now() return { "current_time": now.isoformat(), "date": now.strftime("%Y-%m-%d"), "time": now.strftime("%H:%M:%S"), "day_of_week": now.strftime("%A"), "timezone": "UTC", "message": "Time flies when you're having fun!" "day": now.strftime("%A") }
@app.get("/hello/{name}")async def greet_user(name: str): greetings = ["Hey", "Hello", "Hi", "Yo", "What's up"] greeting = random.choice(greetings)def greet_user(name: str): greeting = random.choice(["Hey", "Hello", "Hi", "Yo"]) return { "message": f"{greeting}, {name}!", "status": "You're awesome!", "coolness_boost": "+100 points" "boost": "+100 coolness points" } } } } } } } ] }]]app.py+32-43