Update app.py
Browse files9 unmodified lines1011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071089 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'.","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."]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"]@app.get("/")async 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"},"coolness_level": "Over 9000!"}@app.get("/status")async 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!"}@app.get("/random-fact")async def random_fact():fact = random.choice(COOL_FACTS)return {"fact": fact,"category": "mind = blown","timestamp": datetime.now().isoformat()}@app.get("/motivate")async def get_motivation():quote = random.choice(MOTIVATIONAL_QUOTES)return {"quote": quote,"message": "You got this!","vibes": "Positive","timestamp": datetime.now().isoformat()}@app.get("/time")async 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!"}@app.get("/hello/{name}")async def greet_user(name: str):greetings = ["Hey", "Hello", "Hi", "Yo", "What's up"]greeting = random.choice(greetings)return {"message": f"{greeting}, {name}!","status": "You're awesome!","coolness_boost": "+100 points"}}}}}}}}]]9 unmodified lines101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979 unmodified lines)COOL_FACTS = ["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 are not.","There are more stars in the universe than grains of sand on all Earth's beaches."]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("/")def root():return {"message": "Welcome to The-Chef's Epic API!","version": "2.0.0","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")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(),"message": "Running smooth like butter","coolness_level": "Maximum"}@app.get("/random-fact")def random_fact():return {"fact": random.choice(COOL_FACTS),"category": "Mind Blown","timestamp": datetime.now().isoformat()}@app.get("/motivate")def get_motivation():return {"quote": random.choice(QUOTES),"message": "You got this!","timestamp": datetime.now().isoformat()}@app.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": now.strftime("%A")}@app.get("/hello/{name}")def greet_user(name: str):greeting = random.choice(["Hey", "Hello", "Hi", "Yo"])return {"message": f"{greeting}, {name}!","status": "You're awesome!","boost": "+100 coolness points"}}}}}}]}]]
app.py+32-43