File size: 603 Bytes
03ce7ac
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
from sc_google_maps_api import ScrapeitCloudClient
import json

def gmaps_parser(location, country_code):
        
        client = ScrapeitCloudClient(api_key='06dbfb89-957c-4263-ad72-1a016669e8f8')
        
        params = {
                "keyword": location,
                "country": country_code,
                "domain": "com"
                }

        try:
            response = client.scrape(params)
            data = json.loads(response.text)
            
            return data

        except Exception as e:
            return {"error": f"Maps cannot scrape the requested details."}