|
@@ -122,7 +122,7 @@ async def get_domain_by_keyword(req:kw_req):
|
|
|
jsdict = {'SiteName':row['SiteName'],'Description':row['Description'],'GlobalRank':row['GlobalRank']
|
|
|
,'Title':row['Title'],'Category':row['Category'],'CountryRank':row['CountryRank'],'EstimatedMonthlyVisits':eval(row['EstimatedMonthlyVisits'])
|
|
|
,'totalVisits':row['totalVisits']}
|
|
|
-
|
|
|
+ print(jsdict)
|
|
|
if jsdict==None:
|
|
|
headers = {"x-rapidapi-key": "6dd30886e0msh7aefc9a0a794398p1896f2jsn275c45475609",
|
|
|
"x-rapidapi-host": "similarweb2.p.rapidapi.com"}
|
|
@@ -133,8 +133,10 @@ async def get_domain_by_keyword(req:kw_req):
|
|
|
url = "https://similarweb2.p.rapidapi.com/trafficoverview"
|
|
|
querystring = {"website":domain_name}
|
|
|
|
|
|
- jsdict['totalVisits'] = js['engagement']['totalVisits']
|
|
|
- jsdict['EstimatedMonthlyVisits']=js['monthlyVisitsEstimate']
|
|
|
+ response = requests.request("GET", url, headers=headers, params=querystring)
|
|
|
+ js2=json.loads(response.text)
|
|
|
+ jsdict['totalVisits'] = js2['engagement']['totalVisits']
|
|
|
+ jsdict['EstimatedMonthlyVisits']=js2['monthlyVisitsEstimate']
|
|
|
log_table = db['storage_similar_web']
|
|
|
log_table.insert({'SiteName':raw_domain,'Description':jsdict['Description'],'GlobalRank':jsdict['GlobalRank']
|
|
|
,'Title':jsdict['Title'],'Category':jsdict['Category'],'CountryRank':jsdict['CountryRank'],'EstimatedMonthlyVisits':jsdict['EstimatedMonthlyVisits']
|