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

No key yet? scrapercity.start_here("dentists in Austin") needs none: a guided tour with what ScraperCity is, how to sign up, the plans and the trial with their live terms, and real searches with live counts. With a key, ScraperCity().start_here(...) plans for your account and returns the exact next call.

The trial, plainly: The trial is real usage, not a demo or a free tier: $5 of credit for 7 days that works on every tool and database at the normal prices, so you can pull real records on day one and judge the data. A card is required at signup. When the 7 days end, the plan picked at signup starts; cancel before then from billing and nothing more is charged. If the credit runs out sooner, database pulls wait (nothing is charged for them); a scraper run that goes past the credit starts the plan early. Planning searches and checking counts are free. start_here() returns the live terms.

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 (included on $149/mo and up; per record from credits on a trial or $49)
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; on a trial or the $49 plan each new record is paid from credits. 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.0017 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
scrape_signals /api/v1/scrape/signals $0.0094 per company running ads, $0.0009 per website per platform checked, $0.0043 per company hiring; minimum charge per search
scrape_ucc_filings /api/v1/scrape/ucc-filings $0.0028 per filing
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.39

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.39
File Size Uploaded Provenance Actions
scrapercity-1.0.39.tar.gz 30.6 kB Without provenance Details for scrapercity-1.0.39.tar.gz

Built distribution (wheel)

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

Total release size: 58.1 kB

Release files / scrapercity-1.0.39.tar.gz

Download URL scrapercity-1.0.39.tar.gz
Size 30.6 kB
Tags Source
SHA-256 checksum
How to use checksums
06315bfcdd71f846e8042eba09777423e9d55d0a64076164716464c88b220c48
BLAKE2b-256 checksum
How to use checksums
0f4857d04255d553519d8502e0c91323094f831b55e1a5e6afe4e895b9958344
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.39-py3-none-any.whl

Download URL scrapercity-1.0.39-py3-none-any.whl
Size 27.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
f08bb10dfabec94d62b4cdd24203907c694371686115dbecc098a831dd08be91
BLAKE2b-256 checksum
How to use checksums
7a1ccf04f89f8b54b96bb5a3827b845575cff51ec4d6fe278205dc361d822f35
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.39

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.

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