from fastapi import FastAPI import requests app = FastAPI() @app.get("/") def hello(): return {"health": "running"} @app.get("/ip") def get_ip(): ip = requests.get("https://ip4only.me/api/").text.split(",")[1] return {"server_ip": ip}