ming 3 роки тому
батько
коміт
90e6526ef5
1 змінених файлів з 4 додано та 4 видалено
  1. 4 4
      similar_web/main.py

+ 4 - 4
similar_web/main.py

@@ -70,13 +70,13 @@ async def get_domain_data(raw_domain):
     if jsdict==None:
         headers = {"x-rapidapi-key": "6dd30886e0msh7aefc9a0a794398p1896f2jsn275c45475609",
             "x-rapidapi-host": "similarweb2.p.rapidapi.com"}
-        await response = requests.request("GET", url, headers=headers, params=querystring)
+        response = requests.request("GET", url, headers=headers, params=querystring)
         js=json.loads(response.text)
         jsdict={'SiteName':js['name'],'Description':js['siteDescription'],'GlobalRank':js['globalRank'],'Title':js['name'],'Category':js['categoryRank']['taxonomy'],'CountryRank':js['countryRank']['rank']}
         url = "https://similarweb2.p.rapidapi.com/trafficoverview"
         querystring = {"website":domain_name}
 
-        await response = requests.request("GET", url, headers=headers, params=querystring)
+        response = requests.request("GET", url, headers=headers, params=querystring)
         js2=json.loads(response.text)
         jsdict['totalVisits'] = js2['engagement']['totalVisits']
         jsdict['EstimatedMonthlyVisits']=js2['monthlyVisitsEstimate']
@@ -122,12 +122,12 @@ async def index():
 @app.post("/kw_dm")
 async def get_domain_by_keyword(req:kw_req):
     ls = domain_filter(search(req.keyword,num_results=20))
-    jsdict = asyncio.run(get_domain_data(ls[0]))
+    jsdict = get_domain_data(ls[0])
     return JSONResponse(content=jsdict)
     
 @app.post("/dm")
 async def get_domain_data(req:q_req):
-    jsdict = asyncio.run(get_domain_data(req.domain_name))
+    jsdict = get_domain_data(req.domain_name)
     print(jsdict)
     return JSONResponse(content=jsdict)