main.py 422 B

1234567891011121314151617181920
  1. #pip install fastapi
  2. #pip install uvicorn
  3. import redis
  4. from fastapi import FastAPI,Form, Request
  5. import json
  6. import uvicorn
  7. import zipfile
  8. app = FastAPI()
  9. @app.get("/getbtn")
  10. def read_root(request: Request):
  11. r = redis.Redis(host='db.ptt.cx', port=6379, db=2,password='choozmo9')
  12. data=r.get('btn_data')
  13. return {'data':data}
  14. if __name__ == "__main__":
  15. uvicorn.run("main:app", host="0.0.0.0", port=9898)