serpapi-local-dev-loop

Featured

Configure SerpApi local development with cached responses and test fixtures. Use when building search integrations, avoiding API calls during development, or setting up reproducible test data from SerpApi. Trigger: "serpapi dev setup", "serpapi local", "test serpapi locally".

AI & Automation 2,944 stars 440 forks Updated today MIT

Install

View on GitHub

Quality Score: 99/100

Stars 20%
100
Recency 20%
100
Frontmatter 20%
70
Documentation 15%
100
Issue Health 10%
50
License 10%
100
Description 5%
100

Skill Content

# SerpApi Local Dev Loop ## Overview Set up local development for SerpApi with response caching, fixture recording, and offline testing. SerpApi charges per search, so caching results locally is critical for cost-effective development. ## Instructions ### Step 1: Record Real Responses as Fixtures ```python import serpapi, json, os, hashlib def record_fixture(params: dict, fixtures_dir="tests/fixtures"): """Run a real search and save the response as a fixture file.""" os.makedirs(fixtures_dir, exist_ok=True) client = serpapi.Client(api_key=os.environ["SERPAPI_API_KEY"]) result = client.search(**params) # Deterministic filename from params key = hashlib.md5(json.dumps(params, sort_keys=True).encode()).hexdigest()[:12] path = os.path.join(fixtures_dir, f"{params['engine']}_{key}.json") with open(path, "w") as f: json.dump(dict(result), f, indent=2) print(f"Recorded: {path}") # Record fixtures for common queries record_fixture({"engine": "google", "q": "python tutorial", "num": 5}) record_fixture({"engine": "youtube", "search_query": "react hooks"}) record_fixture({"engine": "bing", "q": "machine learning"}) ``` ### Step 2: Mock Client for Testing ```python import json, os class MockSerpApiClient: def __init__(self, fixtures_dir="tests/fixtures"): self.fixtures_dir = fixtures_dir def search(self, **params): key = hashlib.md5(json.dumps(params, sort_keys=True).encode()).hexdigest()[:12] path =...

Details

Author
jeremylongshore
Repository
jeremylongshore/claude-code-plugins-plus-skills
Created
1 years ago
Last Updated
today
Language
Python
License
MIT

Integrates with

Bundled in these plugins

Similar Skills

Semantically similar based on skill content — not just same category