urllib GET
from urllib.request import urlopen
with urlopen("https://httpbin.org/get", timeout=10) as resp:
print(resp.read()[:200])
FastAPI
pip install fastapi uvicorn
from fastapi import FastAPI
app = FastAPI()
@app.get("/ping")
def ping() -> dict[str, str]:
return {"status": "ok"}
uvicorn main:app --reload
Loading comments...