Skip to main content

ScraperCity Python SDK

The official Python SDK for ScraperCity: B2B lead generation for AI agents and developers. Query the Lead Database, the Local Business Database and the Ecommerce Store Database, scrape Google Maps and Apollo, find and validate emails, find mobile numbers, skip trace, and more, from plain Python or from any LangChain, LangGraph or OpenAI agent.

The SDK carries the same tool list as the ScraperCity MCP server. It is regenerated from the live API docs on every release, so a new scraper or a new filter reaches Python the same day it reaches the MCP.

pip install scrapercity
pip install "scrapercity[langchain]"   # LangChain / LangGraph tools
pip install "scrapercity[openai]"      # OpenAI Agents SDK tools

Get your API key at app.scrapercity.com/dashboard/api-docs, then export SCRAPERCITY_API_KEY=your_key (or pass it to ScraperCity("your_key")).

Quick start

from scrapercity import ScraperCity

sc = ScraperCity()  # reads SCRAPERCITY_API_KEY

print(sc.wallet())  # balance and plan

# Instant database search ($149/mo plan and up)
leads = sc.query_leads(title="Head of Marketing", country=["United States"], hasEmail=True, limit=25)

# Not sure of the filter values? Describe who you want in plain English.
plan = sc.plan_search("dentists in Austin, Texas")

# Scrapers run in the background: start, wait, download
run = sc.scrape_maps("plumbers", "Denver, CO", limit=200)
sc.poll_until_done(run["runId"])
sc.download(run["runId"], "plumbers.csv")

Every tool by name

ScraperCity.tools() (or scrapercity.TOOLS) lists every tool with its name, description and JSON schema. Run any of them with the same arguments an MCP client would send:

sc.call_tool("query_local_business_database", {"keyword": ["thai restaurant"], "location": ["Houston TX"], "hasEmail": True})
sc.call_tool("validate_emails", {"emails": ["jane@acme.com"]})

LangChain and LangGraph

from scrapercity import langchain_tools
from langgraph.prebuilt import create_react_agent

tools = langchain_tools()                     # every tool
# tools = langchain_tools(include=["plan_search", "query_lead_database"])
agent = create_react_agent(llm, tools)
agent.invoke({"messages": [("user", "Find 50 VPs of Sales at SaaS companies in Texas with emails")]})

OpenAI Agents SDK and function calling

from agents import Agent, Runner
from scrapercity.openai_tools import get_tools

agent = Agent(name="Lead finder", tools=get_tools())
Runner.run_sync(agent, "Find 100 roofing companies in Phoenix with phone numbers")
import json
from openai import OpenAI
from scrapercity.openai_tools import get_function_definitions, handle_tool_call

client = OpenAI()
resp = client.chat.completions.create(model="gpt-4.1", messages=messages, tools=get_function_definitions())
for call in resp.choices[0].message.tool_calls or []:
    result = handle_tool_call(call.function.name, call.function.arguments)  # JSON string for the tool message

For the Responses API use get_response_tools().

Errors

A failed call raises scrapercity.ScraperCityError with the API's message, .status (the HTTP code) and .data (the answer body). ScraperCityError is a RuntimeError, so code written for older versions keeps working.

Pricing

Scrapers charge per result from your credits. The database tools are included with the $149/mo plan and up. Prices below come from the live catalog on each release.

Tool Endpoint Price
scrape_apollo /api/v1/scrape/apollo $0.0039 per lead
scrape_website_finder /api/v1/scrape/website-finder $0.0499 per contact found
find_people /api/v1/scrape/skip-trace $0.0199 per result (searches with 0 matches are billed as 1 result)
scrape_distress_list /api/v1/scrape/distress-list $0.05 per property
validate_emails /api/v1/scrape/email-validator $0.0072 per email
scrape_maps /api/v1/scrape/maps $0.0099 per business
scrape_airbnb /api/v1/scrape/airbnb-email $0.019 per result ($19.00 per 1,000)
scrape_bizbuysell /api/v1/scrape/bizbuysell-scraper $0.0099 per listing
scrape_crexi /api/v1/scrape/crexi-scraper $0.029 per property
scrape_angi /api/v1/scrape/angi-angies-list-scraper $0.0099 per listing
scrape_yelp /api/v1/scrape/yelp-scraper $0.0099 per result
scrape_zillow_agents /api/v1/scrape/zillow-agents $0.029 per agent
scrape_property_lookup /api/v1/scrape/property-lookup $0.15 per property (+$0.10 for owner contact)
search_criminal_records /api/v1/scrape/criminal-records $1.00 per search (only charged if records found)
scrape_store_leads /api/v1/scrape/store-leads $0.0039 per lead
scrape_builtwith /api/v1/scrape/techstack $4.99 per technology
find_emails /api/v1/scrape/email-finder $0.05 per email found (FREE if not found)
find_mobiles /api/v1/scrape/mobile-finder $0.25 per number found (FREE if not found)

Also from ScraperCity

MIT License

Metadata

Release files for scrapercity 1.0.24

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for scrapercity 1.0.24
File Size Uploaded Provenance
scrapercity-1.0.24.tar.gz 26.1 kB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for scrapercity 1.0.24
File Interpreter ABI Platform
scrapercity-1.0.24-py3-none-any.whl Python 3 none any Details

Total release size: 49.4 kB

Release files / scrapercity-1.0.24.tar.gz

Download URL scrapercity-1.0.24.tar.gz
Size 26.1 kB
Tags Source
SHA-256 checksum
How to use checksums
283facdcb9b0f24e5d38f30b054eaee8c5e9b223bd8a8139147d1d5805086fc7
BLAKE2b-256 checksum
How to use checksums
e17faeb9fd61631014732faa3005526e749d937dfee10e793c4a06c15c55998b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.10.12

Release files / scrapercity-1.0.24-py3-none-any.whl

Download URL scrapercity-1.0.24-py3-none-any.whl
Size 23.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
f8585ca918240d1f69f7cd118000f043d6e3c2acb72dc23050bd5221986d5611
BLAKE2b-256 checksum
How to use checksums
7f9c70003adb99ecbca190cbc4629e85fc0618709cc9f1565b529da645bc671f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.10.12

Security for scrapercity 1.0.24

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

1.0.24 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page