Official TVPulse SDK for Python
Project description
TVPulse Python SDK
The official Python SDK for the TVPulse API.
Installation
pip install tvpulse
Usage
First, you need to initialize the Client with your API key. You can get your API key from the TVPulse UI.
import os
from tvpulse import Client, TVPulseError
# Initialize the SDK
# It's recommended to store your API key in an environment variable.
api_key = os.environ.get("TVPULSE_API_KEY")
if not api_key:
raise ValueError("TVPULSE_API_KEY environment variable not set.")
client = Client(api_key=api_key)
Get Data
You can use the get_data method to retrieve data from the API. This method takes the following arguments:
searchTypes: A list of search types to use. Currently, only one search type is supported at a time. Valid search types are"asr"and"ocr".keyword: The keyword to search for.streams: A list of streams to search.start_date: The start date of the search inYYYY-MM-DD HH:MM:SSformat.end_date: The end date of the search inYYYY-MM-DD HH:MM:SSformat.frequency: The frequency of the search. Valid values are"hour"and"day".score_threshold: The score threshold for the search. This should be a float between 0 and 1.
Here's an example of how to use the get_data method:
try:
data = client.get_data(
searchTypes=["asr"],
keyword="コーヒー",
streams=["CX", "EX", "NTV", "TBS", "TX"],
start_date="2025-01-01 00:00:00",
end_date="2025-01-02 23:59:59",
frequency="hour",
score_threshold=0.95
)
print(data)
except TVPulseError as e:
print(f"An error occurred: {e}")
Error Handling
The SDK raises custom exceptions for different types of errors. You can catch these exceptions to handle errors gracefully.
TVPulseError: The base class for all SDK errors.AuthenticationError: Raised when there is an authentication error (e.g., an invalid API key).InvalidRequestError: Raised when the request is invalid (e.g., a missing or invalid parameter).
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
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file tvpulse-0.1.1.tar.gz.
File metadata
- Download URL: tvpulse-0.1.1.tar.gz
- Upload date:
- Size: 6.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.11.13
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
88b4b51fe0e52c89b12c666a2bf14f1e2f74bcf18e8e71dc1c60c8362e6a3e27
|
|
| MD5 |
4a640e9e656aaebe88a7be2b24970867
|
|
| BLAKE2b-256 |
093aec3259bf84ea59362c21dae99bf0258c7cd7f5da18d63d3e6a67737bd84f
|
File details
Details for the file tvpulse-0.1.1-py3-none-any.whl.
File metadata
- Download URL: tvpulse-0.1.1-py3-none-any.whl
- Upload date:
- Size: 6.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.11.13
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
e2e1bb33676434fb4da9d3519c12a291a16d76e5dfc90eb3fe3a0adb04c2238e
|
|
| MD5 |
5416084d4833e3013eed01bc4de35366
|
|
| BLAKE2b-256 |
1a1f143cc1f9ae2d8360e9bbc0417b6bf2904c602f987163c5508c863d7db3ee
|