Skip to main content

Django integration for the serp.cheap Google SERP API — app, settings, cached client, management command.

Project description

serpcheap-django

Django integration for the serp.cheap Google Search API — real-time Google SERP data (organic results, ads, knowledge graph, page scraping, rank tracking), wrapped as a Django app with settings, cached client, and a management command.

It's the cheapest Google Search API we know of — $0.0003 per cached search, $0.0006 fresh, no monthly minimum (~10× cheaper than SerpApi).

Wraps the serpcheap Python SDK with a Django app, settings-driven config, transparent result caching via Django's cache framework, and a management command.

Install

pip install serpcheap-django

Add the app and configure it in settings.py:

INSTALLED_APPS = [
    # ...
    "serpcheap_django",
]

SERPCHEAP = {
    "API_KEY": os.environ["SERPCHEAP_API_KEY"],  # get one at https://app.serp.cheap
}

Usage

from serpcheap_django import serpcheap

results = serpcheap.search("best running shoes", gl="us")
page = serpcheap.scrape("https://example.com")
rank = serpcheap.rank("example.com", "best running shoes")

Results are cached by default (keyed by query + options) using your default Django cache, so repeat calls don't spend credits. Reach the raw, uncached SDK client when you need it:

from serpcheap_django import get_client

for page in get_client().client.search_pages("best running shoes", to=3):
    ...

Management command

python manage.py serpcheap_search "best running shoes" --gl us --page 1
python manage.py serpcheap_search "best running shoes" --json

Configuration

All keys are optional except API_KEY:

SERPCHEAP = {
    "API_KEY": "...",                       # required
    "BASE_URL": "https://api.serp.cheap",
    "TIMEOUT_MS": 15000,
    "MAX_RETRIES": 2,
    "CACHE": {
        "ENABLED": True,
        "ALIAS": "default",                 # any cache alias from settings.CACHES
        "TTL": 3600,
    },
}

Set CACHE["ENABLED"] = False to disable result caching entirely.

License

MIT

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

serpcheap_django-0.2.0.tar.gz (6.7 kB view details)

Uploaded Source

Built Distribution

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

serpcheap_django-0.2.0-py3-none-any.whl (6.5 kB view details)

Uploaded Python 3

File details

Details for the file serpcheap_django-0.2.0.tar.gz.

File metadata

  • Download URL: serpcheap_django-0.2.0.tar.gz
  • Upload date:
  • Size: 6.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for serpcheap_django-0.2.0.tar.gz
Algorithm Hash digest
SHA256 e1ff65a8d861dfc2306f060ad5b57b6f7162a563d0f29ac09903481e79b0eb96
MD5 541b6a6bc0014beb3e7d0732d8a4c606
BLAKE2b-256 0e58f87fa19a1c68e049c5b26c3e8efdf3ff7126651e98feaf299ead4c0e7445

See more details on using hashes here.

File details

Details for the file serpcheap_django-0.2.0-py3-none-any.whl.

File metadata

File hashes

Hashes for serpcheap_django-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 4f7761a771edc68be8e0a6a20360da870d89d4e46cbd4c33ed0eaa11a3cd877a
MD5 fe83053a6d8db6942113c71692a3e13c
BLAKE2b-256 d65a6d225a2f0a001c60b7aaaf08fd5494846c2a78b8adee105af53f8144fcf0

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