Skip to main content

A Python package for performing cached web searches using the Brave Search API

Project description

Searcherator

Searcherator is a Python package that provides a convenient way to perform web searches using the Brave Search API with built-in caching capabilities.

Installation

pip install searcherator

Requirements

  • Python 3.8+
  • Brave Search API key

Usage

from searcherator import Searcherator
import asyncio

async def main():
    # Basic search in English (US)
    search = Searcherator("Python programming language")
    
    # Get URLs from search results
    urls = await search.urls()
    print(urls)
    
    # German search with more results
    german_search = Searcherator(
        "Zusammenfassung Buch 'Demian' von 'Hermann Hesse'",
        language="de",
        country="de",
        num_results=10
    )
    
    # Print full search results
    await german_search.print()

if __name__ == "__main__":
    asyncio.run(main())

API Reference

Searcherator

Searcherator(
    search_term: str = "",
    num_results: int = 5,
    country: str | None = "us",
    language: str | None = "en",
    api_key: str | None = None,
    clear_cache: bool = False,
    ttl: int = 7
)

Parameters

  • search_term: The query string to search for
  • num_results: Maximum number of results to return (default: 5)
  • country: Country code for search results (default: "us")
  • language: Language code for search results (default: "en")
  • api_key: Brave Search API key (default: None, will try to use BRAVE_API_KEY environment variable)
  • clear_cache: Whether to clear existing cached results (default: False)
  • ttl: Time-to-live for cached results in days (default: 7)

Methods

  • async urls() -> list[str]: Returns a list of URLs from the search results
  • async search_result() -> dict: Returns the full search results as a dictionary
  • async print(): Prints the full search results in a formatted way

Authentication

Set your Brave Search API key as an environment variable:

export BRAVE_API_KEY="your-api-key-here"

Alternatively, provide the API key directly when initializing the Searcherator:

search = Searcherator("My search term", api_key="your-api-key-here")

License

MIT License

Author

Arved Klöhn - GitHub

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

searcherator-0.0.2.tar.gz (3.2 kB view details)

Uploaded Source

Built Distribution

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

searcherator-0.0.2-py3-none-any.whl (3.5 kB view details)

Uploaded Python 3

File details

Details for the file searcherator-0.0.2.tar.gz.

File metadata

  • Download URL: searcherator-0.0.2.tar.gz
  • Upload date:
  • Size: 3.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.5

File hashes

Hashes for searcherator-0.0.2.tar.gz
Algorithm Hash digest
SHA256 8644b62dcb8fb997b9d989b1f74a82e4638610288cfe54ea4d881b47369d37a0
MD5 bd36e46a7dc2fc6587bc646dfc8dcd42
BLAKE2b-256 9dde7d884251b2f2ae0ed35e7383084c8d226b455ed6f452e1ade63b0dbe22ae

See more details on using hashes here.

File details

Details for the file searcherator-0.0.2-py3-none-any.whl.

File metadata

  • Download URL: searcherator-0.0.2-py3-none-any.whl
  • Upload date:
  • Size: 3.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.5

File hashes

Hashes for searcherator-0.0.2-py3-none-any.whl
Algorithm Hash digest
SHA256 0d302dc080ed0e85a9daafea86760b4a2faa4e65b44dad88bf0fc2b90c223bbf
MD5 1e11de3a4386e6255ac9a82a509378e8
BLAKE2b-256 0021a0bfdf5a2b2af80ce930f450d2c478ff3472c02d0c46c5640be05272cc61

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