Skip to main content

A wrapper to scrape Google Places API with logging and export support

Project description

Google Places Scraper

A Python wrapper and CLI tool to scrape nearby places using the Google Places API. Useful for lead generation, local business discovery, and location data gathering.


✨ Features

  • 🔍 Search places by location, radius, and type (e.g., schools, hospitals)
  • 📞 Fetch detailed info: address, phone, website
  • 📤 Export results as CSV, JSON, or YAML
  • 💰 Log request stats and estimated cost per Google API pricing
  • 🖥️ Use via Python or command-line (CLI)

📦 Installation

From PyPI:

pip install google-places-scraper

From local build:

pip install dist/google_places_scraper-0.1.0-py3-none-any.whl

For development (editable mode):

pip install -e .

🐍 Python Usage

You can use it directly in your Python scripts:

from google_places_scraper import GooglePlacesScraper

scraper = GooglePlacesScraper(api_key="YOUR_GOOGLE_API_KEY")
scraper.run(
    user_location_input="Karachi, Pakistan",
    radius=3000,
    type_="school",
    export_format="csv",  # Options: csv, json, yaml
    max_results=50
)

🚀 CLI Usage

After installation, run the CLI:

google-places-scraper

You’ll be prompted to enter:

Enter your Google Places API Key: AIzaxxxxx Enter location name or 'latitude,longitude': Karachi Enter radius in meters (default 5000): 3000 Export format (csv/json/yaml) [default=csv]: csv Enter type of place (default=school): school Max number of results (leave blank for no limit): 10


📄 Output

The tool generates one of the following files based on your export format:

leads.csv

leads.json

leads.yaml

Containing the following fields:

name

formatted_address

formatted_phone_number

website

Example (CSV):

name,formatted_address,formatted_phone_number,website "ABC School","Main Street, Karachi","021-1234567","http://abcschool.edu.pk"


🛠 Development

Build the package:

rm -rf dist build *.egg-info python -m build

or

make install

then

twine upload dist/*

Reinstall after changes:

pip install --force-reinstall dist/google_places_scraper-0.1.0-py3-none-any.whl


Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

google_places_scraper-0.1.1.tar.gz (6.0 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

google_places_scraper-0.1.1-py3-none-any.whl (6.9 kB view details)

Uploaded Python 3

File details

Details for the file google_places_scraper-0.1.1.tar.gz.

File metadata

  • Download URL: google_places_scraper-0.1.1.tar.gz
  • Upload date:
  • Size: 6.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.3

File hashes

Hashes for google_places_scraper-0.1.1.tar.gz
Algorithm Hash digest
SHA256 da435681db0cff06062cceb2063db3a87c14c6c542026c54fe387d4cad6351da
MD5 ad138c1cfafd249100c24d44a9846315
BLAKE2b-256 f6cbb3b1b33f5540940b5efe04da1289e41d8268e960e9168a31d85d39eab901

See more details on using hashes here.

File details

Details for the file google_places_scraper-0.1.1-py3-none-any.whl.

File metadata

File hashes

Hashes for google_places_scraper-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 306b69b96efeef9b9aa6964b8434579d4a78c5d8f2d1658f05caa4eb88f4d47b
MD5 80d073a31d6c0105efedb2b04e0291b8
BLAKE2b-256 66ae3c4ef51d060352b51be3af0e7cfb01bdd2ae84dd287c5db1d3854980c523

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page