This Python script allows you to find kitchen showrooms near a specified location using the Google Places API. The results are saved in a CSV file.
- Python 3.x installed on your system.
- A Google Cloud Platform account to obtain an API key.
- Go to the Google Cloud Console.
- Create a new project or select an existing one.
- Navigate to the API & Services Dashboard.
- Click on "Enable APIs and Services" and search for "Places API".
- Enable the "Places API".
- Go to the Credentials page.
- Click "Create Credentials" and select "API Key".
- Copy the API key and save it for later use.
-
Clone the Repository: To clone the repository using Git, open your terminal or command prompt and run the following command:
git clone https://github.com/AndrewVII/allstyle-maps-scraper.git
-
Download as ZIP: Alternatively, you can download the code as a ZIP file. Click on the "Code" button at the top of this page, and select "Download ZIP". Extract the ZIP file to your desired location.
Once you have the code on your local machine, proceed with setting up the environment as described below.
-
Open Terminal: You can find it in Applications > Utilities or search for it using Spotlight (Cmd + Space).
-
Navigate to the Project Directory: Use the
cdcommand to change to the directory where yourmain.pyfile is located. For example:cd path/to/your/project -
Create a Virtual Environment:
python3 -m venv venv
-
Activate the Virtual Environment:
source venv/bin/activate -
Install Required Packages:
pip install -r requirements.txt
-
Open Command Prompt: Press
Win + R, typecmd, and press Enter. -
Navigate to the Project Directory: Use the
cdcommand to change to the directory where yourmain.pyfile is located. For example:cd path\to\your\project -
Create a Virtual Environment:
python -m venv venv
-
Activate the Virtual Environment:
venv\Scripts\activate
-
Install Required Packages:
pip install -r requirements.txt
-
Create a
.envFile: In the same directory asmain.py, create a file named.envand add your API key:GOOGLE_API_KEY=your_api_key_here -
Run the Script:
python main.py
-
View the Results: The script will output the results in JSON format and save them to a file named
showrooms.csv.
- Ensure your API key is kept secure and not shared publicly.
- The script is set to search for "kitchen showrooms near Hotel Indigo in Miami Brickell" by default. You can modify the
search_queryvariable inmain.pyto change the search location or query.
- If you encounter any issues with package installation, ensure that your virtual environment is activated and that you have an active internet connection.
- For any API-related errors, verify that your API key is correct and that the Places API is enabled in your Google Cloud project.