All URIs are relative to https://api.unifapi.com
| Method | HTTP request | Description |
|---|---|---|
| news_search_post | POST /news/search | Search News |
NewsSearchPost200Response news_search_post(news_search_request=news_search_request)
Search News
Run one live News search and receive the ranked news articles and top-stories blocks for a query, including title, publisher domain, snippet, image, and publish time.
- Bearer Authentication (bearerAuth):
import unifapi
from unifapi.models.news_search_post200_response import NewsSearchPost200Response
from unifapi.models.news_search_request import NewsSearchRequest
from unifapi.rest import ApiException
from pprint import pprint
# Defining the host is optional and defaults to https://api.unifapi.com
# See configuration.py for a list of all supported configuration parameters.
configuration = unifapi.Configuration(
host = "https://api.unifapi.com"
)
# The client must configure the authentication and authorization parameters
# in accordance with the API server security policy.
# Examples for each auth method are provided below, use the example that
# satisfies your auth use case.
# Configure Bearer authorization: bearerAuth
configuration = unifapi.Configuration(
access_token = os.environ["BEARER_TOKEN"]
)
# Enter a context with an instance of the API client
with unifapi.ApiClient(configuration) as api_client:
# Create an instance of the API class
api_instance = unifapi.NewsApi(api_client)
news_search_request = unifapi.NewsSearchRequest() # NewsSearchRequest | (optional)
try:
# Search News
api_response = api_instance.news_search_post(news_search_request=news_search_request)
print("The response of NewsApi->news_search_post:\n")
pprint(api_response)
except Exception as e:
print("Exception when calling NewsApi->news_search_post: %s\n" % e)| Name | Type | Description | Notes |
|---|---|---|---|
| news_search_request | NewsSearchRequest | [optional] |
- Content-Type: application/json
- Accept: application/json
| Status code | Description | Response headers |
|---|---|---|
| 200 | OK | - |
| 400 | Validation or invalid-id error | - |
| 401 | Missing, invalid, disabled, revoked, or expired UnifAPI API key | - |
| 402 | Insufficient workspace credits | - |
| 404 | Resource not found | - |
| 429 | Rate limited | - |
| 500 | Internal error | - |
| 502 | Source error | - |
| 503 | Source unavailable | - |
[Back to top] [Back to API list] [Back to Model list] [Back to README]