main.py 703 B

1234567891011121314151617181920212223
  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,ssl_keyfile='/etc/letsencrypt/live/liff.googo.org/privkey.pem',ssl_certfile='/etc/letsencrypt/live/liff.googo.org/cert.pem')
  16. #--ssl-keyfile=/etc/letsencrypt/www.choozmo.com/privkey1.pem --ssl-certfile=/etc/letsencrypt/www.choozmo.com/cert1.pem
  17. #/etc/letsencrypt/live/liff.googo.org