File size: 250 Bytes
cd7674a
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
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}