Package: py-mediastack
py-mediastackAn unofficial python helper package to interact with the mediastack API.DrawbacksNo historical Data (I don't have a paid account to test it)No News Sources search (I don't have time to implement it)Feel free to contribute. Make sure that you use thepre-commithooks.What can it do ?It can give you live news updated.Installationpip3 install py-mediastackUsageGet the api key fromherefrommediastackimportMediaStackclient=MediaStack("<your-api-key>")resp=client.get_live_news()print(resp.pagination)print(resp.data[0])Pagination(limit=25, offset=0, count=25, total=10000)

Article(author='Redazione', title='Via agli incontri di quartiere:
primo appuntamento con i residenti di San Lorenzo',
description='Hanno preso il via ieri sera, dalla sala Biasin dove l’Amministrazione ha convocato i residenti del quartiere San Lorenzo, gli ‘Incontri di quartiere’ con cui la Giunta si confronta con i cittadini. Presenti, oltre al Sindaco Gian Francesco Menani, il vicesindaco Camilla Nizzoli e gli assessori Corrado Ruini e Massimo Malagoli, che hanno ascoltato le [&#8230;]',
url='https://www.bologna2000.com/2021/09/07/via-agli-incontri-di-quartiere-primo-appuntamento-con-i-residenti-di-san-lorenzo/',
image=None,
category='general',
language='it',
 country='it',
 published_at='2021-09-07T08:32:52+00:00',
 source='bologna2000')The parameters forMediaStack.get_live_newsare as follow:sources:Optional[list[str]]-> Use this parameter to include or exclude one or multiple news sources. Example: To include CNN, but exclude BBC:sources=["cnn", "-bbc"]categories:Optional[list[str]]Use this parameter to include or exclude one or multiple news categories. Example: To include business, but exclude sports:categories=["business", "-sports"].countries:Optional[list[str]]-> Use this parameter to include or exclude one or multiple countries. Example: To include Australia, but exclude the US:countries=["au", "-us"].languages:Optional[list[str]]-> Use this parameter to include or exclude one or multiple languages. Example: To include English, but exclude German:languages=["en", "-de"].keywords:Optional[str]-> Use this parameter to search for sentences, you can also exclude words that you do not want to appear in your search results. Example: To search for "New movies 2021" but exclude "Matrix":keywords='new movies 2021 -matrix'date:Optional[str]-> Use this parameter to specify a date or date range. Example:date=2020-01-01for news on Jan 1st anddate='2020-12-24,2020-12-31'for news between Dec 24th and 31st.sort:Optional[str]-> Use this parameter to specify a sorting order. Available values:published_desc(default),published_asc,popularitylimit:Optional[int]-> Use this parameter to specify a pagination limit (number of results per page) for your API request. Default limit value is 25, maximum allowed limit value is 100.offset:Optional[int]-> Use this parameter to specify a pagination offset value for your API request. Example: An offset value of 100 combined with a limit value of 10 would show results 100-110. Default value is 0, starting with the first available result.Theget_live_newsmethods returns aLiveNewsResponsedata class.
It contains thepaginationdetails and thedata.TheLiveNewsResponse.paginationis of typePaginationand has the following
attributes.Pagination.limit-> your pagination limit value.Pagination.offset-> your pagination offset value.Pagination.count-> the results count on the current page.Pagination.total-> the total count of results available.TheLiveNewsResponse.datais alist[Article]and eachArticlehas the following
attributes.Article.author-> the name of the author of the given news article.Article.title-> the title text of the given news article.Article.description-> the description text of the given news article.Article.url- > the URL leading to the given news article.Article.image-> an image URL associated with the given news article.Article.category-> the category associated with the given news article.Article.language-> the language the given news article is in.Article.country-> the country code associated with the given news article.Article.published_at-> the exact time stamp the given news article was published.Article.source-> the source from which the article was takenSupported News Categoriesgeneral - Uncategorized Newsbusiness - Business Newsentertainment - Entertainment Newshealth - Health Newsscience - Science Newssports - Sports Newstechnology - Technology NewsSupported CountriesClickHereto see the list of all the supported countries.Supported Languagesar - Arabicde - Germanen - Englishes - Spanishfr - Frenchhe - Hebrewit - Italiannl - Dutchno - Norwegianpt - Portugueseru - Russianse - Swedishzh - ChineseMost of the docs are directly taken from themediastacks api docs