brave-search-python-client 0.4.27
pip install brave-search-python-client
Released:
🦁 Brave Search Python Client supporting Web, Image, News and Video search.
Navigation
Unverified details
These details havenot been verified by PyPIProject links
Meta
- License: MIT License (MIT License Copyright (c) [2025] [Helmut Hoffer von Ankershoffen (helmuthva@googlemail.com)] Permi...)
- Author:Helmut Hoffer von Ankershoffen
- Tags act, api, brave, brave-api, brave-search, brave-search-api, brave-search-python-client, bravesearch, bravesearchapi, codecov, copier, cyclonedx, detect-secrets, devcontainer, docker, git-cliff, jupyter, marimo, mypy, nox, oe-python-template, pip-audit, pip-licenses, pre-commit, pydantic, pypi, pytest, python, readthedocs, ruff, sonarcloud, sonarqube, sphinx, streamlit, typer, uv, web-search, websearch
- Requires: Python <4.0, >=3.11
- Provides-Extra:
examples
Classifiers
- Development Status
- Framework
- Intended Audience
- License
- Natural Language
- Operating System
- Programming Language
- Typing
Project description
🦁 Brave Search Python Client
[!TIP]📚Online documentation - 📖PDF Manual
[!NOTE]🧠 This project was scaffolded using the templateoe-python-template withcopier.
Brave Search Python Client supporting Web, Image, News and Video search.
Use Cases:
- Integrate into your Python code to help users find what they're looking for.
- Add to your AI applications to give LLMs access to current web information.
- Use the built-in CLI in shell scripts to get search results in JSON format.
Overview
Adding Brave Search Python Client to your project as a dependency is easy.
uvaddbrave-search-python-client# add dependency to your projectIf you don't have uv installed followthese instructions.If you still prefer pip over the modern and fast package manageruv, you can install the library like this:
pipinstallbrave-search-python-client# add dependency to your projectObtain your Brave Search API key bysigning up here - the free tier includes 2,000requests per month. For guidance on how to integrate the Brave Search Pythonclient into your code base check out the examples below and explore thereference documentation.If you just want to try out the client without having to write code you can usethe integrated CLI:
exportBRAVE_SEARCH_API_KEY=YOUR_API_KEY# replace YOUR_API_KEYuvxbrave-search-python-clientweb"hello world"# search for hello worldAll advanced search options of Brave Search are supportedby the clientand in the CLI:
# Find all German content about AI added in the last 24 hoursuvxbrave-search-python-clientweb--country=DE--search-lang=de--units=metric--freshness=pdaiThe CLI provides extensive help:
uvxbrave-search-python-client--help# all CLI commandsuvxbrave-search-python-clientweb--help# all options for web searchuvxbrave-search-python-clientimages--help# all options image searchuvxbrave-search-python-clientvideos--help# all options video searchuvxbrave-search-python-clientnews--help# all options news searchOperational Excellence
This project is designed with operational excellence in mind, using modernPython tooling and practices. It includes:
- Various examples demonstrating usage: a.Simple Python scriptb.Streamlit web applicationdeployed onStreamlit Community Cloud c.JupyterandMarimonotebook
- Complete reference documentationon Read the Docs
- Transparent test coverageincluding unit and E2E tests (reported on Codecov)
- Matrix tested withmultiple python versionsto ensure compatibility (powered byNox)
- Compliant with modern linting and formatting standards (powered byRuff)
- Up-to-date dependencies (monitored byRenovate andDependabot)
- A-grade code qualityin security, maintainability, and reliability with low technical debt andcodesmell (verified by SonarQube)
- Additional code security checks usingCodeQL
- Security Policy
- License compliant with the Open Source Initiative (OSI)
- 1-liner for installation and execution of command line interface (CLI) viauv(x) orDocker
- Setup for developing inside adevcontainerincluded (supports VSCode and GitHub Codespaces)
Usage Examples
Streamlit App
Minimal Python Script:
"""Example script demonstrating the usage of the Brave Search Python Client.For web, image, video and news search."""importasyncioimportosfromdotenvimportload_dotenvfromrich.consoleimportConsolefrombrave_search_python_clientimport(BraveSearch,CountryCode,ImagesSearchRequest,LanguageCode,NewsSearchRequest,VideosSearchRequest,WebSearchRequest,)# Load .env file and get Brave Search API key from environmentload_dotenv()api_key=os.getenv("BRAVE_SEARCH_API_KEY")ifnotapi_key:msg="BRAVE_SEARCH_API_KEY not found in environment"raiseValueError(msg)asyncdefsearch()->None:"""Run various searches using the Brave Search Python Client (see https://brave-search-python-client.readthedocs.io/en/latest/lib_reference.html)."""# Initialize the Brave Search Python client, using the API key from the environmentbs=BraveSearch()# Perform a web searchresponse=awaitbs.web(WebSearchRequest(q="jupyter"))# Print results as JSON# Iterate over web hits and render links in markdownfor_resultinresponse.web.resultsifresponse.webelse[]:pass# Advanced search with parametersresponse=awaitbs.web(WebSearchRequest(q="python programming",country=CountryCode.DE,search_lang=LanguageCode.DE,),)for_resultinresponse.web.resultsifresponse.webelse[]:pass# Search and render imagesresponse=awaitbs.images(ImagesSearchRequest(q="cute cats"))for_imageinresponse.resultsor[]:pass# Search and render videosresponse=awaitbs.videos(VideosSearchRequest(q="singularity is close"))for_videoinresponse.resultsor[]:pass# Search and render newsresponse=awaitbs.news(NewsSearchRequest(q="AI"))for_iteminresponse.resultsor[]:pass# Run the async search function# Alternatively use await search() from an async functionasyncio.run(search())Read the library reference documentationfor an explanation of available classes and methods.
Jupyter Notebook
Command Line Interface (CLI)
Run withuvx
Add Brave Search API key to the environment
exportBRAVE_SEARCH_API_KEY=YOUR_API_KEYShow available commands:
uvxbrave-search-python-client--helpSearch the web for "hello world":
uvxbrave-search-python-clientweb"hello world"Show options for web search
uvxbrave-search-python-clientweb--helpSearch images:
uvxbrave-search-python-clientimages"hello world"Show options for image search
uvxbrave-search-python-clientimages--helpSearch videos:
uvxbrave-search-python-clientvideos"hello world"Show options for videos search
uvxbrave-search-python-clientvideos--helpSearch news:
uvxbrave-search-python-clientnews"hello world"Show options for news search
uvxbrave-search-python-clientnews--helpRead the CLI reference documentationfor an explanation of all commands and options.
Run with Docker
Note: Replace YOUR_BRAVE_SEARCH_API_KEY with your API key in the followingexamples.
Show available commands:
dockerrunhelmuthva/brave-search-python-client--helpSearch the web:
dockerrun--envBRAVE_SEARCH_API_KEY=YOUR_BRAVE_SEARCH_API_KEYhelmuthva/brave-search-python-clientweb"hello world"Show options for web search
dockerrunhelmuthva/brave-search-python-clientweb--helpSearch images:
dockerrun--envBRAVE_SEARCH_API_KEY=YOUR_BRAVE_SEARCH_API_KEYhelmuthva/brave-search-python-clientimages"hello world"Show options for image search
dockerrunhelmuthva/brave-search-python-clientimages--helpSearch videos:
dockerrun--envBRAVE_SEARCH_API_KEY=YOUR_BRAVE_SEARCH_API_KEYhelmuthva/brave-search-python-clientvideos"hello world"Show options for video search
dockerrunhelmuthva/brave-search-python-clientvideos--helpSearch news:
dockerrun--envBRAVE_SEARCH_API_KEY=YOUR_BRAVE_SEARCH_API_KEYhelmuthva/brave-search-python-clientnews"hello world"Show options for news search
dockerrunhelmuthva/brave-search-python-clientnews--helpOr use docker compose
File .env is passed through
dockercomposeupdockercomposerunbrave-search-python-client--helpFurther Reading
- Inspect oursecurity policy with detailed documentation of checks, tools and principles.
- Check out theCLI reference with detailed documentation of all CLI commands and options.
- Check out thelibrary reference with detailed documentation of public classes and functions.
- Check out theAPI reference with detailed documentation of all API operations and parameters.
- Ourrelease notes provide a complete log of recent improvements and changes.
- In case you want to help us improve 🦁 Brave Search Python Client: Thecontribution guidelines explain how to setup your development environment and create pull requests.
- We gratefully acknowledge theopen source projects that this project builds upon. Thank you to all these wonderful contributors!
Star History
Project details
Unverified details
These details havenot been verified by PyPIProject links
Meta
- License: MIT License (MIT License Copyright (c) [2025] [Helmut Hoffer von Ankershoffen (helmuthva@googlemail.com)] Permi...)
- Author:Helmut Hoffer von Ankershoffen
- Tags act, api, brave, brave-api, brave-search, brave-search-api, brave-search-python-client, bravesearch, bravesearchapi, codecov, copier, cyclonedx, detect-secrets, devcontainer, docker, git-cliff, jupyter, marimo, mypy, nox, oe-python-template, pip-audit, pip-licenses, pre-commit, pydantic, pypi, pytest, python, readthedocs, ruff, sonarcloud, sonarqube, sphinx, streamlit, typer, uv, web-search, websearch
- Requires: Python <4.0, >=3.11
- Provides-Extra:
examples
Classifiers
- Development Status
- Framework
- Intended Audience
- License
- Natural Language
- Operating System
- Programming Language
- Typing
Release historyRelease notifications |RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more aboutinstalling packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more aboutwheel file names.
Copy a direct link to the current filters
File details
Details for the filebrave_search_python_client-0.4.27.tar.gz.
File metadata
- Download URL:brave_search_python_client-0.4.27.tar.gz
- Upload date:
- Size: 124.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.6.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 | 3b8803dd8d4bac8110de2c5ba3014610e6bb36da7ea19ad9ce62b5f1deb38d5a | |
| MD5 | 765006607778fe5db398da0a77cd3ee1 | |
| BLAKE2b-256 | 1d56bbd47494ebf93742a4ccb40d758a93d0cc1bc0a9513f9106ac9b6f0fa7a2 |
File details
Details for the filebrave_search_python_client-0.4.27-py3-none-any.whl.
File metadata
- Download URL:brave_search_python_client-0.4.27-py3-none-any.whl
- Upload date:
- Size: 128.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.6.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 | 5b7b7a93f46a825517f81b42dc6c0c6ddcabee4a0fe44ce92b9ceae6a37699ec | |
| MD5 | 3fcd6cbc57a555e7bef0841e394cec2f | |
| BLAKE2b-256 | 98d3ae16180d52456d8fedcb288e4e4927dd806ce0a43d8ec9b9388ea6c6b072 |