PyLeadFinder
Find and enrich business leads using Google Places API with ZIP code optimization. Optionally includes email extraction via website scraping.
Installation
pip install pyleadfinder
Requirements:
- Python 3.9+
- Google Places API key (get one)
Usage
PyLeadFinder supports three operating modes:
1. API Mode (Default) - For Integration
Returns JSON-serializable dictionaries directly.
from pyleadfinder import leadfinder
results = leadfinder(
places_api_key="YOUR_KEY",
queries=["liquor stores"],
bounds=(45.4, 45.6, -122.8, -122.5), # (min_lat, max_lat, min_lng, max_lng)
radius=30
)
# Use the data in your application
for company in results['companies']:
print(f"{company.name}: {company.email}")
2. CSV Mode - For Spreadsheets
Export data to CSV format for use in Excel, Google Sheets, or other tools.
from pyleadfinder import leadfinder
results = leadfinder(
places_api_key="YOUR_KEY",
queries=["coffee shops"],
bounds=(45.4, 45.6, -122.8, -122.5),
output_mode="csv"
)
# Outputs: leads.csv
3. KML Mode - For Google My Maps
Output KML files that can be imported directly into Google My Maps.
from pyleadfinder import leadfinder
results = leadfinder(
places_api_key="YOUR_KEY",
queries=["restaurants"],
bounds=(45.4, 45.6, -122.8, -122.5),
output_mode="kml"
)
# Outputs: leads.kml
How It Works
- ZIP Code Optimization: Uses hexagonal grid packing to minimize API calls (40-60% reduction).
- Places Search: Multi-threaded search across optimized locations.
- Email Extraction: Scrapes company websites for contact info (optional).
- Export: Generates output based on selected mode.
Arguments
leadfinder(
# Required
places_api_key: str, # Google Places API key
queries: list[str], # Search terms like ["restaurants"]
bounds: tuple, # (min_lat, max_lat, min_lng, max_lng)
# Optional
output_name: str = "leads", # Base filename for outputs
radius: int = 30, # Search radius
radius_unit: str = "miles", # Unit: "miles", "km", "meters", "yards"
output_mode: str = "api", # "api" (default), "csv", or "kml"
# Advanced Options (kwargs)
excluded_keywords: list = [], # Keywords to filter out companies/URLs
num_workers: int = 10, # Number of threads for parallel processing
timeout: int = None, # Operation timeout in seconds (None = no limit)
scrape_emails: bool = False # Scrape websites for emails (Default: False)
)
Output Modes
"api"(default): Returns data in a dictionary, no file output."csv": Generates a CSV file with all company data."kml": Generates a KML file for Google My Maps import.
About the radius parameter
- Smaller radius = better coverage and more complete results.
- Smaller radius = significantly more API calls.
- The ZIP code optimizer uses this radius to determine coverage density.
- Example: radius=10 might require 3-4x more ZIP codes than radius=30.
Output Files
API Mode: No files generated - use the returned dictionary with companies, stats, and map_data.
CSV Mode: Spreadsheet export with columns: name, address, city, state, zip_code, phone, website, emails, latitude, longitude, place_id.
KML Mode: Import directly to Google My Maps.
Examples
See examples/ directory for working examples of all three modes.
License
MIT License - Copyright 2025 Austin Rakowski
Metadata
Release files for pyleadfinder 0.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| pyleadfinder-0.1.0.tar.gz | 18.8 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| pyleadfinder-0.1.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 37.3 kB
Release files / pyleadfinder-0.1.0.tar.gz
| Download URL | pyleadfinder-0.1.0.tar.gz |
|---|---|
| Size | 18.8 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
6fba13746d430da34ff1fb1a8d7ae3f90bde904aa6f5260939e9608cd553fd3e
|
|
BLAKE2b-256 checksum How to use checksums |
1c7126ffbef27d2e20bf0327c6138a6fd028573a2348cedc1a4c4e165f2dead5
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.12.1
|
Release files / pyleadfinder-0.1.0-py3-none-any.whl
| Download URL | pyleadfinder-0.1.0-py3-none-any.whl |
|---|---|
| Size | 18.4 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
d8f280325de0bcf68f3bd3df41cf754b41851abfccdd5f7cfe5e49145dc70288
|
|
BLAKE2b-256 checksum How to use checksums |
ed2d385d5be3c758cac4e1e3abfc82e3540caa85c2f26c490a4d167dcfdc8e89
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.12.1
|