Skip to main content

🦁 Brave Search Python Client supporting Web, Image, News and Video search.

Project description

[PRE-ALPHA] 🦁 Brave Search Python Client

License PyPI - Python Version CI Quality Gate Security Maintainability Technical Debt Coverage Ruff GitHub - Version GitHub - Commits PyPI - Version PyPI - Status Docker - Version Docker - Size

⚠️ WARNING: This project is currently in pre-alpha phase, i.e. partly functional. Feel free to already watch or star the repository to stay updated on its progress.

Overview

Brave Search Python Client supporting Web, Image, News and Video search.

  • Modern async Python client for Web, Image, Video and News search powered by Brave Search
  • Thorough validation of both requests and responess (powered by Pydantic)
  • 100% test coverage (unit and E2E tests)
  • 100% compliance modern linting and formatting standards (powered by Ruff)
  • 100% up-to-date dependencies through automated updates (reported on Codecov)
  • A-grade code quality ratings in security, maintainability, and reliability (verified by SonarQube)
  • 1-liner for installation and execution of command line interface (CLI) via uv(x) or Docker
  • Setup for developing in devcontainer included (supports VSCode and GitHub Codespaces)
  • MCP Server to connect Brave Search with Claude Desktop and other MCP clients

Python Client

Basic Web Search

from brave_search import BraveSearch

# Initialize client with your API key
client = BraveSearch(api_key="YOUR-API-KEY")

# Perform a web search
results = client.web_search("brave browser")

# Access search results
for result in results.web:
    print(f"Title: {result.title}")
    print(f"URL: {result.url}")
    print(f"Description: {result.description}")

Image Search

# Search for images
image_results = client.image_search("cute cats")

for image in image_results.images:
    print(f"Image URL: {image.url}")
    print(f"Source: {image.source}")

News Search

# Search for news articles
news_results = client.news_search("technology")

for article in news_results.news:
    print(f"Title: {article.title}")
    print(f"Published: {article.published}")

Video Search

# Search for videos
video_results = client.video_search("python tutorials")

for video in video_results.videos:
    print(f"Title: {video.title}")
    print(f"URL: {video.url}")

Using Search Parameters

# Advanced search with parameters
results = client.web_search(
    "python programming",
    country="US",
    search_lang="en",
)

Command Line Interface (CLI)

Run with uvx

Create .env file with API key:

./setup--dot-env YOUR_BRAVE_SEARCH_API_KEY

Show available commands:

```shell
uvx brave-search-python-client --help

Execute web search:

uvx brave-search-python-client web "hello world"

Show options for web search

uvx brave-search-python-client web --help

Execute image search:

uvx brave-search-python-client image "hello world"

Show options for image search

uvx brave-search-python-client image --help

Execute videos search:

uvx brave-search-python-client video "hello world"

Show options for videos search

uvx brave-search-python-client video --help

Execute news search:

uvx brave-search-python-client video "hello world"

Run with Docker

Show options for news search

docker run helmuthva/brave-search-python-client news --help

Docker

Note: Replace YOUR_BRAVE_SEARCH_API_KEY with your API key in the following examples.

Show available commands:

docker run helmuthva/brave-search-python-client --help

Execute web search:

docker run --env BRAVE_SEARCH_API_KEY=YOUR_BRAVE_SEARCH_API_KEY helmuthva/brave-search-python-client web "hello world"

Show options for web search

docker run helmuthva/brave-search-python-client web --help

Execute image search:

docker run --env BRAVE_SEARCH_API_KEY=YOUR_BRAVE_SEARCH_API_KEY helmuthva/brave-search-python-client image "hello world"

Show options for image search

docker run helmuthva/brave-search-python-client image --help

Execute videos search:

docker run --env BRAVE_SEARCH_API_KEY=YOUR_BRAVE_SEARCH_API_KEY helmuthva/brave-search-python-client video "hello world"

Show options for videos search

docker run helmuthva/brave-search-python-client video --help

Execute news search:

docker run --env BRAVE_SEARCH_API_KEY=YOUR_BRAVE_SEARCH_API_KEY helmuthva/brave-search-python-client video "hello world"

Show options for news search

docker run helmuthva/brave-search-python-client news --help

Extra: MCP Server

TK

Contributing

Please read our Contributing Guidelines for how to setup your development environment, and guidance for making pull requests.

Resources

Star History

Star History Chart

Project details


Release history Release notifications | RSS feed

This version

0.0.7

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

brave_search_python_client-0.0.7.tar.gz (13.7 MB view details)

Uploaded Source

Built Distribution

brave_search_python_client-0.0.7-py3-none-any.whl (29.8 kB view details)

Uploaded Python 3

File details

Details for the file brave_search_python_client-0.0.7.tar.gz.

File metadata

File hashes

Hashes for brave_search_python_client-0.0.7.tar.gz
Algorithm Hash digest
SHA256 321d3b937ea09920687a0a249fa5f1a82238aaae992df48eed44b3bec99ef920
MD5 65936819925b5bf53efeb0d0a40e1454
BLAKE2b-256 492ec4e77e3872da1d49101f2ba43af789606fdb7e93196e27379ab6b8e08fc5

See more details on using hashes here.

File details

Details for the file brave_search_python_client-0.0.7-py3-none-any.whl.

File metadata

File hashes

Hashes for brave_search_python_client-0.0.7-py3-none-any.whl
Algorithm Hash digest
SHA256 221d8834820d896807d0b1f38a3f2898cbc1482e2d84865cd4e2fc92bbf7386a
MD5 df4c5404b7480e01cdecfd8af17b2e1d
BLAKE2b-256 d579415d86c9c4166dade0012977167df04667449b33c7d207d73b7794ec2494

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page