Skip to main content

Python wrapper for the Tavily API

Project description

This Python wrapper allows for easy interaction with the Tavily API, offering both basic and advanced search functionalities directly from your Python programs. Easily integrate smart search capabilities into your applications, harnessing Tavily’s powerful search features.

Installing

pip install tavily-python

Usage

from tavily import Client
tavily = Client(api_key="YOUR_API_KEY")
# For basic search:
tavily.search(query="Should I invest in Apple in 2024?")
# For advanced search:
tavily.search(query="Should I invest in Apple in 2024?", search_depth="advanced")

API Methods

Client

The Client class is the entry point to interacting with the Tavily API. Kickstart your journey by instantiating it with your API key.

Methods

  • search(query, search_depth="basic", **kwargs): Performs a search using the specified query. The depth of the search can be controlled by the search_depth parameter.

Keyword Arguments

  • search_depth (str): The depth of the search. It can be “basic” or “advanced”. Default is “basic”.

  • max_results (int): The number of search results to return. Default is 10.

  • include_domains (list): A list of domains to specifically include in the search results. Default is None, which includes all domains.

  • exclude_domains (list): A list of domains to specifically exclude from the search results. Default is None, which doesn’t exclude any domains.

  • include_answer (bool): Whether or not to include answers in the search results. Default is False.

  • include_raw_content (bool): Whether or not to include raw content in the search results. Default is False.

Both methods internally call the _search method to communicate with the API.

Error Handling

In case of an unsuccessful HTTP request, a HTTPError will be raised.

License

This project is licensed under the terms of the MIT license.

Contact

For questions, support, or to learn more, please visit Tavily.

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

tavily-python-0.1.8.tar.gz (2.8 kB view details)

Uploaded Source

Built Distribution

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

tavily_python-0.1.8-py3-none-any.whl (3.0 kB view details)

Uploaded Python 3

File details

Details for the file tavily-python-0.1.8.tar.gz.

File metadata

  • Download URL: tavily-python-0.1.8.tar.gz
  • Upload date:
  • Size: 2.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.9.12

File hashes

Hashes for tavily-python-0.1.8.tar.gz
Algorithm Hash digest
SHA256 a19642bcde6bd5847b9ac83441ccfc25cc2655efbba73788911390f40a97d4ee
MD5 c1ac21dd2ce42f34092427e77855532d
BLAKE2b-256 a7931ed359afc91c8a3c60f1d1b5d95731c658f65478c8c801f0cc4ba713a832

See more details on using hashes here.

File details

Details for the file tavily_python-0.1.8-py3-none-any.whl.

File metadata

  • Download URL: tavily_python-0.1.8-py3-none-any.whl
  • Upload date:
  • Size: 3.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.9.12

File hashes

Hashes for tavily_python-0.1.8-py3-none-any.whl
Algorithm Hash digest
SHA256 ee98b4f68b14ea294dfdd51ed86976c4e78d50b8067fe129d23c04396500d51e
MD5 8f95d8cc3e66b545c51b90a0dc17ba3c
BLAKE2b-256 de7fcaa248485f54a604808da442c9a579338cbc3052177484fb012b4e5cb100

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