Septzzz's picture
Upload folder using huggingface_hub (part 20)
dc960e3 verified
Raw
History Blame Contribute Delete
2.21 kB
import requests
import json
from datetime import date, datetime, timedelta
import os
from typing import Optional, Dict, Union, List
def getfullreviews(fullsort: str, fullid: str, toolbench_rapidapi_key: str='088440d910mshef857391f2fc461p17ae9ejsnaebc918926ff'):
"""
"this endpoint get all the reviews in one request"
"""
url = f"https://google-reviews-scraper.p.rapidapi.com/"
querystring = {'fullsort': fullsort, 'fullid': fullid, }
headers = {
"X-RapidAPI-Key": toolbench_rapidapi_key,
"X-RapidAPI-Host": "google-reviews-scraper.p.rapidapi.com"
}
response = requests.get(url, headers=headers, params=querystring)
try:
observation = response.json()
except:
observation = response.text
return observation
def searchbusiness(keyword: str, toolbench_rapidapi_key: str='088440d910mshef857391f2fc461p17ae9ejsnaebc918926ff'):
"""
"with this endpoint you can search the business you want to get their reviews and ratings"
"""
url = f"https://google-reviews-scraper.p.rapidapi.com/"
querystring = {'keyword': keyword, }
headers = {
"X-RapidAPI-Key": toolbench_rapidapi_key,
"X-RapidAPI-Host": "google-reviews-scraper.p.rapidapi.com"
}
response = requests.get(url, headers=headers, params=querystring)
try:
observation = response.json()
except:
observation = response.text
return observation
def getreviews(sort: str, nextpage: str, is_id: str, toolbench_rapidapi_key: str='088440d910mshef857391f2fc461p17ae9ejsnaebc918926ff'):
"""
"with this endpoint you can all reviews for any business searched with pagination"
"""
url = f"https://google-reviews-scraper.p.rapidapi.com/"
querystring = {'sort': sort, 'nextpage': nextpage, 'id': is_id, }
headers = {
"X-RapidAPI-Key": toolbench_rapidapi_key,
"X-RapidAPI-Host": "google-reviews-scraper.p.rapidapi.com"
}
response = requests.get(url, headers=headers, params=querystring)
try:
observation = response.json()
except:
observation = response.text
return observation