ming il y a 3 ans
Parent
commit
87fbf1fa0d
1 fichiers modifiés avec 2 ajouts et 1 suppressions
  1. 2 1
      similar_web/main.py

+ 2 - 1
similar_web/main.py

@@ -13,7 +13,7 @@ from fastapi.middleware.cors import CORSMiddleware
 from pydantic import BaseModel
 from googlesearch import search
 import asyncio
-
+import time
 fake_rank_plus = 700
 fake_traffic_weighted = 1.3
 
@@ -132,6 +132,7 @@ async def get_domain_by_keyword(req:kw_req):
         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}
+        time.sleep(5)
         try:
             response = requests.request("GET", url, headers=headers, params=querystring)
             js2=json.loads(response.text)