Init Commit

This commit is contained in:
2026-01-29 17:40:31 +03:30
commit 1e4f6e21ac
3 changed files with 47 additions and 0 deletions

24
main.py Normal file
View File

@@ -0,0 +1,24 @@
from fastapi import FastAPI, Request
from pydantic import BaseModel
import uvicorn
app = FastAPI()
class IPResponse(BaseModel):
your_public_ip: str
port: str
msg: str
@app.get("/", response_model=IPResponse)
def my_ip(request: Request):
client_ip = request.headers.get("X-Real-IP") or request.headers.get("X-Forwarded-For") or request.client.host
client_port = request.headers.get("X-Forwarded-Port") or str(request.client.port)
return {
"your_public_ip": client_ip,
"port": client_port,
"msg": "abbas be mole"
}
if __name__ == "__main__":
uvicorn.run(app, host="0.0.0.0", port=1000)