Your Name 3 anos atrás
pai
commit
07a85fadf7
1 arquivos alterados com 43 adições e 0 exclusões
  1. 43 0
      choozmo/urlshorten/main.py

+ 43 - 0
choozmo/urlshorten/main.py

@@ -0,0 +1,43 @@
+import time
+from fastapi import FastAPI
+import sys
+import os
+import datetime
+import ast
+from fastapi.responses import JSONResponse, FileResponse
+from fastapi.middleware.cors import CORSMiddleware
+from pydantic import BaseModel
+import asyncio
+import time
+
+
+app = FastAPI()
+
+origins = [
+    "http://www.googo.org",
+    "http://www.googo.org:8080",
+    "http://0.0.0.0:8080",
+    "http://googo.org:8080",
+    "http://googo.org",
+    "http://139.162.121.30"
+]
+#uvicorn main:app --host 0.0.0.0 --port 8001
+app.add_middleware(
+    CORSMiddleware,
+    allow_origins=origins,
+    allow_credentials=True,
+    allow_methods=["*"],
+    allow_headers=["*"],
+)
+
+class q_req(BaseModel):
+    domain_name: str
+class kw_req(BaseModel):
+    fullurl: str
+
+@app.post("/urldata")
+async def get_domain_by_keyword(req:kw_req):
+    url=kw_req.fullurl
+    print(url)
+    return "OK"
+