Visit our website https://newscatcherapi.com
- Requirements
- Installation
- Getting Started
- Async
- Raw HTTP Response
- Reference
newscatcher.authors.getnewscatcher.authors.postnewscatcher.latest_headlines.getnewscatcher.latest_headlines.postnewscatcher.search.getnewscatcher.search.postnewscatcher.search_link.getnewscatcher.search_link.postnewscatcher.search_similar.getnewscatcher.search_similar.postnewscatcher.sources.getnewscatcher.sources.postnewscatcher.subscription.getnewscatcher.subscription.post
Python >=3.7
pip install newscatcherapi-python-sdk==6.0.14from pprint import pprint
from newscatcherapi_client import Newscatcher, ApiException
newscatcher = Newscatcher(
api_key="YOUR_API_KEY",
)
try:
# [Get] Search By Author Request
get_response = newscatcher.authors.get(
author_name="author_name_example",
not_author_name="string_example",
sources=None,
predefined_sources=None,
not_sources=None,
lang=None,
not_lang=None,
countries=None,
not_countries=None,
from_="string_example",
to_="string_example",
published_date_precision="string_example",
by_parse_date=False,
sort_by="relevancy",
ranked_only="string_example",
from_rank=1,
to_rank=1,
is_headline=True,
is_opinion=True,
is_paid_content=True,
parent_url=None,
all_links=None,
all_domain_links=None,
word_count_min=0,
word_count_max=0,
page=1,
page_size=100,
include_nlp_data=True,
has_nlp=True,
theme="string_example",
not_theme="string_example",
title_sentiment_min=3.14,
title_sentiment_max=3.14,
content_sentiment_min=3.14,
content_sentiment_max=3.14,
iptc_tags=None,
not_iptc_tags=None,
iab_tags=None,
not_iab_tags=None,
)
print(get_response)
except ApiException as e:
print("Exception when calling AuthorsApi.get: %s\n" % e)
pprint(e.body)
if e.status == 422:
pprint(e.body["detail"])
pprint(e.headers)
pprint(e.status)
pprint(e.reason)
pprint(e.round_trip_time)async support is available by prepending a to any method.
import asyncio
from pprint import pprint
from newscatcherapi_client import Newscatcher, ApiException
newscatcher = Newscatcher(
api_key="YOUR_API_KEY",
)
async def main():
try:
# [Get] Search By Author Request
get_response = await newscatcher.authors.aget(
author_name="author_name_example",
not_author_name="string_example",
sources=None,
predefined_sources=None,
not_sources=None,
lang=None,
not_lang=None,
countries=None,
not_countries=None,
from_="string_example",
to_="string_example",
published_date_precision="string_example",
by_parse_date=False,
sort_by="relevancy",
ranked_only="string_example",
from_rank=1,
to_rank=1,
is_headline=True,
is_opinion=True,
is_paid_content=True,
parent_url=None,
all_links=None,
all_domain_links=None,
word_count_min=0,
word_count_max=0,
page=1,
page_size=100,
include_nlp_data=True,
has_nlp=True,
theme="string_example",
not_theme="string_example",
title_sentiment_min=3.14,
title_sentiment_max=3.14,
content_sentiment_min=3.14,
content_sentiment_max=3.14,
iptc_tags=None,
not_iptc_tags=None,
iab_tags=None,
not_iab_tags=None,
)
print(get_response)
except ApiException as e:
print("Exception when calling AuthorsApi.get: %s\n" % e)
pprint(e.body)
if e.status == 422:
pprint(e.body["detail"])
pprint(e.headers)
pprint(e.status)
pprint(e.reason)
pprint(e.round_trip_time)
asyncio.run(main())To access raw HTTP response values, use the .raw namespace.
from pprint import pprint
from newscatcherapi_client import Newscatcher, ApiException
newscatcher = Newscatcher(
api_key="YOUR_API_KEY",
)
try:
# [Get] Search By Author Request
get_response = newscatcher.authors.raw.get(
author_name="author_name_example",
not_author_name="string_example",
sources=None,
predefined_sources=None,
not_sources=None,
lang=None,
not_lang=None,
countries=None,
not_countries=None,
from_="string_example",
to_="string_example",
published_date_precision="string_example",
by_parse_date=False,
sort_by="relevancy",
ranked_only="string_example",
from_rank=1,
to_rank=1,
is_headline=True,
is_opinion=True,
is_paid_content=True,
parent_url=None,
all_links=None,
all_domain_links=None,
word_count_min=0,
word_count_max=0,
page=1,
page_size=100,
include_nlp_data=True,
has_nlp=True,
theme="string_example",
not_theme="string_example",
title_sentiment_min=3.14,
title_sentiment_max=3.14,
content_sentiment_min=3.14,
content_sentiment_max=3.14,
iptc_tags=None,
not_iptc_tags=None,
iab_tags=None,
not_iab_tags=None,
)
pprint(get_response.body)
pprint(get_response.headers)
pprint(get_response.status)
pprint(get_response.round_trip_time)
except ApiException as e:
print("Exception when calling AuthorsApi.get: %s\n" % e)
pprint(e.body)
if e.status == 422:
pprint(e.body["detail"])
pprint(e.headers)
pprint(e.status)
pprint(e.reason)
pprint(e.round_trip_time)This endpoint allows you to search for articles by author. You need to specify the author name. You can also filter by language, country, source, and more.
get_response = newscatcher.authors.get(
author_name="author_name_example",
not_author_name="string_example",
sources=None,
predefined_sources=None,
not_sources=None,
lang=None,
not_lang=None,
countries=None,
not_countries=None,
from_="string_example",
to_="string_example",
published_date_precision="string_example",
by_parse_date=False,
sort_by="relevancy",
ranked_only="string_example",
from_rank=1,
to_rank=1,
is_headline=True,
is_opinion=True,
is_paid_content=True,
parent_url=None,
all_links=None,
all_domain_links=None,
word_count_min=0,
word_count_max=0,
page=1,
page_size=100,
include_nlp_data=True,
has_nlp=True,
theme="string_example",
not_theme="string_example",
title_sentiment_min=3.14,
title_sentiment_max=3.14,
content_sentiment_min=3.14,
content_sentiment_max=3.14,
iptc_tags=None,
not_iptc_tags=None,
iab_tags=None,
not_iab_tags=None,
)predefined_sources: Union[bool, date, datetime, dict, float, int, list, str, None]
all_domain_links: Union[bool, date, datetime, dict, float, int, list, str, None]
/api/authors get
π Back to Table of Contents
This endpoint allows you to search for articles by author. You need to specify the author name. You can also filter by language, country, source, and more.
post_response = newscatcher.authors.post(
author_name="string_example",
not_author_name="string_example",
sources=None,
predefined_sources=None,
not_sources=None,
lang=None,
not_lang=None,
countries=None,
not_countries=None,
from_="string_example",
to_="string_example",
published_date_precision="string_example",
by_parse_date=False,
sort_by="relevancy",
ranked_only="string_example",
from_rank=1,
to_rank=1,
is_headline=True,
is_opinion=True,
is_paid_content=True,
parent_url=None,
all_links=None,
all_domain_links=None,
word_count_min=0,
word_count_max=0,
page=1,
page_size=100,
include_nlp_data=True,
has_nlp=True,
theme="string_example",
not_theme="string_example",
title_sentiment_min=3.14,
title_sentiment_max=3.14,
content_sentiment_min=3.14,
content_sentiment_max=3.14,
iptc_tags=None,
not_iptc_tags=None,
iab_tags=None,
not_iab_tags=None,
)predefined_sources: Union[bool, date, datetime, dict, float, int, list, str, None]
all_domain_links: Union[bool, date, datetime, dict, float, int, list, str, None]
/api/authors post
π Back to Table of Contents
This endpoint allows you to get latest headlines. You need to specify since when you want to get the latest headlines. You can also filter by language, country, source, and more.
get_response = newscatcher.latest_headlines.get(
when="7d",
by_parse_date=False,
sort_by="relevancy",
lang=None,
not_lang=None,
countries=None,
not_countries=None,
sources=None,
predefined_sources=None,
not_sources=None,
not_author_name=None,
ranked_only="string_example",
is_headline=True,
is_opinion=True,
is_paid_content=True,
parent_url=None,
all_links=None,
all_domain_links=None,
word_count_min=0,
word_count_max=0,
page=1,
page_size=100,
clustering_variable="string_example",
clustering_enabled=True,
clustering_threshold=3.14,
include_nlp_data=True,
has_nlp=True,
theme="string_example",
not_theme="string_example",
org_entity_name="string_example",
per_entity_name="string_example",
loc_entity_name="string_example",
misc_entity_name="string_example",
title_sentiment_min=3.14,
title_sentiment_max=3.14,
content_sentiment_min=3.14,
content_sentiment_max=3.14,
iptc_tags=None,
not_iptc_tags=None,
iab_tags=None,
not_iab_tags=None,
)predefined_sources: Union[bool, date, datetime, dict, float, int, list, str, None]
not_author_name: Union[bool, date, datetime, dict, float, int, list, str, None]
all_domain_links: Union[bool, date, datetime, dict, float, int, list, str, None]
/api/latest_headlines get
π Back to Table of Contents
This endpoint allows you to get latest headlines. You need to specify since when you want to get the latest headlines. You can also filter by language, country, source, and more.
post_response = newscatcher.latest_headlines.post(
when="7d",
by_parse_date=False,
sort_by="relevancy",
lang=None,
not_lang=None,
countries=None,
not_countries=None,
sources=None,
predefined_sources=None,
not_sources=None,
not_author_name=None,
ranked_only="string_example",
is_headline=True,
is_opinion=True,
is_paid_content=True,
parent_url=None,
all_links=None,
all_domain_links=None,
word_count_min=0,
word_count_max=0,
page=1,
page_size=100,
clustering_variable="string_example",
clustering_enabled=True,
clustering_threshold=3.14,
include_nlp_data=True,
has_nlp=True,
theme="string_example",
not_theme="string_example",
org_entity_name="string_example",
per_entity_name="string_example",
loc_entity_name="string_example",
misc_entity_name="string_example",
title_sentiment_min=3.14,
title_sentiment_max=3.14,
content_sentiment_min=3.14,
content_sentiment_max=3.14,
iptc_tags=None,
not_iptc_tags=None,
iab_tags=None,
not_iab_tags=None,
)predefined_sources: Union[bool, date, datetime, dict, float, int, list, str, None]
not_author_name: Union[bool, date, datetime, dict, float, int, list, str, None]
all_domain_links: Union[bool, date, datetime, dict, float, int, list, str, None]
/api/latest_headlines post
π Back to Table of Contents
This endpoint allows you to search for articles. You can search for articles by keyword, language, country, source, and more.
get_response = newscatcher.search.get(
q="q_example",
search_in="title_content",
predefined_sources=None,
sources=None,
not_sources=None,
lang=None,
not_lang=None,
countries=None,
not_countries=None,
not_author_name=None,
from_="string_example",
to_="string_example",
published_date_precision="string_example",
by_parse_date=False,
sort_by="relevancy",
ranked_only="string_example",
from_rank=1,
to_rank=1,
is_headline=True,
is_opinion=True,
is_paid_content=True,
parent_url=None,
all_links=None,
all_domain_links=None,
word_count_min=0,
word_count_max=0,
page=1,
page_size=100,
clustering_variable="string_example",
clustering_enabled=True,
clustering_threshold=3.14,
include_nlp_data=True,
has_nlp=True,
theme="string_example",
not_theme="string_example",
org_entity_name="string_example",
per_entity_name="string_example",
loc_entity_name="string_example",
misc_entity_name="string_example",
title_sentiment_min=3.14,
title_sentiment_max=3.14,
content_sentiment_min=3.14,
content_sentiment_max=3.14,
iptc_tags=None,
not_iptc_tags=None,
source_name=None,
iab_tags=None,
not_iab_tags=None,
exclude_duplicates=True,
additional_domain_info=True,
is_news_domain=True,
news_domain_type=None,
news_type=None,
)predefined_sources: Union[bool, date, datetime, dict, float, int, list, str, None]
not_author_name: Union[bool, date, datetime, dict, float, int, list, str, None]
all_domain_links: Union[bool, date, datetime, dict, float, int, list, str, None]
news_domain_type: Union[bool, date, datetime, dict, float, int, list, str, None]
/api/search get
π Back to Table of Contents
This endpoint allows you to search for articles. You can search for articles by keyword, language, country, source, and more.
post_response = newscatcher.search.post(
q="string_example",
search_in="title_content",
predefined_sources=None,
sources=None,
not_sources=None,
lang=None,
not_lang=None,
countries=None,
not_countries=None,
not_author_name=None,
from_="string_example",
to_="string_example",
published_date_precision="string_example",
by_parse_date=False,
sort_by="relevancy",
ranked_only="string_example",
from_rank=1,
to_rank=1,
is_headline=True,
is_opinion=True,
is_paid_content=True,
parent_url=None,
all_links=None,
all_domain_links=None,
word_count_min=0,
word_count_max=0,
page=1,
page_size=100,
clustering_variable="string_example",
clustering_enabled=True,
clustering_threshold=3.14,
include_nlp_data=True,
has_nlp=True,
theme="string_example",
not_theme="string_example",
org_entity_name="string_example",
per_entity_name="string_example",
loc_entity_name="string_example",
misc_entity_name="string_example",
title_sentiment_min=3.14,
title_sentiment_max=3.14,
content_sentiment_min=3.14,
content_sentiment_max=3.14,
iptc_tags=None,
not_iptc_tags=None,
source_name=None,
iab_tags=None,
not_iab_tags=None,
exclude_duplicates=True,
additional_domain_info=True,
is_news_domain=True,
news_domain_type=None,
news_type=None,
)predefined_sources: Union[bool, date, datetime, dict, float, int, list, str, None]
not_author_name: Union[bool, date, datetime, dict, float, int, list, str, None]
all_domain_links: Union[bool, date, datetime, dict, float, int, list, str, None]
news_domain_type: Union[bool, date, datetime, dict, float, int, list, str, None]
/api/search post
π Back to Table of Contents
This endpoint allows you to search for articles. You can search for articles by id(s) or link(s).
get_response = newscatcher.search_link.get(
ids=None,
links=None,
from_="string_example",
to_="string_example",
page=1,
page_size=100,
)DtoResponsesSearchResponseSearchResponse
/api/search_by_link get
π Back to Table of Contents
This endpoint allows you to search for articles. You can search for articles by id(s) or link(s).
post_response = newscatcher.search_link.post(
ids=None,
links=None,
from_="string_example",
to_="string_example",
page=1,
page_size=100,
)DtoResponsesSearchResponseSearchResponse
/api/search_by_link post
π Back to Table of Contents
This endpoint returns a list of articles that are similar to the query provided. You also have the option to get similar articles for the results of a search.
get_response = newscatcher.search_similar.get(
q="q_example",
search_in="title_content",
include_similar_documents=False,
similar_documents_number=5,
similar_documents_fields="title,content",
predefined_sources=None,
sources=None,
not_sources=None,
lang=None,
not_lang=None,
countries=None,
not_countries=None,
from_="string_example",
to_="string_example",
by_parse_date=False,
published_date_precision="string_example",
sort_by="relevancy",
ranked_only="string_example",
from_rank=1,
to_rank=1,
is_headline=True,
is_opinion=True,
is_paid_content=True,
parent_url=None,
all_links=None,
all_domain_links=None,
word_count_min=0,
word_count_max=0,
page=1,
page_size=100,
include_nlp_data=True,
has_nlp=True,
theme="string_example",
not_theme="string_example",
title_sentiment_min=3.14,
title_sentiment_max=3.14,
content_sentiment_min=3.14,
content_sentiment_max=3.14,
iptc_tags=None,
not_iptc_tags=None,
)predefined_sources: Union[bool, date, datetime, dict, float, int, list, str, None]
all_domain_links: Union[bool, date, datetime, dict, float, int, list, str, None]
/api/search_similar get
π Back to Table of Contents
This endpoint returns a list of articles that are similar to the query provided. You also have the option to get similar articles for the results of a search.
post_response = newscatcher.search_similar.post(
q="string_example",
search_in="title_content",
include_similar_documents=False,
similar_documents_number=5,
similar_documents_fields="title,content",
predefined_sources=None,
sources=None,
not_sources=None,
lang=None,
not_lang=None,
countries=None,
not_countries=None,
from_="string_example",
to_="string_example",
by_parse_date=False,
published_date_precision="string_example",
sort_by="relevancy",
ranked_only="string_example",
from_rank=1,
to_rank=1,
is_headline=True,
is_opinion=True,
is_paid_content=True,
parent_url=None,
all_links=None,
all_domain_links=None,
word_count_min=0,
word_count_max=0,
page=1,
page_size=100,
include_nlp_data=True,
has_nlp=True,
theme="string_example",
not_theme="string_example",
title_sentiment_min=3.14,
title_sentiment_max=3.14,
content_sentiment_min=3.14,
content_sentiment_max=3.14,
iptc_tags=None,
not_iptc_tags=None,
)predefined_sources: Union[bool, date, datetime, dict, float, int, list, str, None]
all_domain_links: Union[bool, date, datetime, dict, float, int, list, str, None]
/api/search_similar post
π Back to Table of Contents
This endpoint allows you to get the list of sources that are available in the database. You can filter the sources by language and country. The maximum number of sources displayed is set according to your plan. You can find the list of plans and their features here: https://newscatcherapi.com/news-api#news-api-pricing
get_response = newscatcher.sources.get(
lang=None,
countries=None,
predefined_sources=None,
include_additional_info=True,
from_rank=1,
to_rank=1,
source_name=None,
source_url=None,
is_news_domain=True,
news_domain_type=None,
news_type=None,
)predefined_sources: Union[bool, date, datetime, dict, float, int, list, str, None]
news_domain_type: Union[bool, date, datetime, dict, float, int, list, str, None]
/api/sources get
π Back to Table of Contents
This endpoint allows you to get the list of sources that are available in the database. You can filter the sources by language and country. The maximum number of sources displayed is set according to your plan. You can find the list of plans and their features here: https://newscatcherapi.com/news-api#news-api-pricing
post_response = newscatcher.sources.post(
lang=None,
countries=None,
predefined_sources=None,
include_additional_info=True,
from_rank=1,
to_rank=1,
source_name=None,
source_url=None,
is_news_domain=True,
news_domain_type=None,
news_type=None,
)predefined_sources: Union[bool, date, datetime, dict, float, int, list, str, None]
news_domain_type: Union[bool, date, datetime, dict, float, int, list, str, None]
/api/sources post
π Back to Table of Contents
This endpoint allows you to get info about your subscription plan.
get_response = newscatcher.subscription.get()/api/subscription get
π Back to Table of Contents
This endpoint allows you to get info about your subscription plan.
post_response = newscatcher.subscription.post()/api/subscription post
π Back to Table of Contents
This Python package is automatically generated by Konfig