All Projects → mattlisiv → Newsapi Python

mattlisiv / Newsapi Python

Licence: mit
A Python Client for News API

Programming Languages

python
139335 projects - #7 most used programming language

Projects that are alternatives of or similar to Newsapi Python

Grammers
(tele)gramme.rs - use Telegram's API from Rust
Stars: ✭ 109 (-44.39%)
Mutual labels:  api, library
Colore
A powerful C# library for Razer Chroma's SDK
Stars: ✭ 121 (-38.27%)
Mutual labels:  api, library
Typescript Hapi Starter
🚀 Starter for building APIs with Hapi + Typescript!
Stars: ✭ 117 (-40.31%)
Mutual labels:  api, library
Discord.jl
The Julia Discord API Wrapper
Stars: ✭ 93 (-52.55%)
Mutual labels:  api, library
Item Nbt Api
Add custom NBT tags to Items/Tiles/Entities without NMS!
Stars: ✭ 163 (-16.84%)
Mutual labels:  api, library
Soundcloud
Soundcloud.com API wrapper written in PHP with OAuth2 support.
Stars: ✭ 94 (-52.04%)
Mutual labels:  api, library
Stripe Sdk
A simple and flexible Stripe library for Flutter with complete support for SCA and PSD2.
Stars: ✭ 120 (-38.78%)
Mutual labels:  api, library
Libgui
Buttons & Co
Stars: ✭ 78 (-60.2%)
Mutual labels:  api, library
Deeply
PHP client for the DeepL.com translation API (unofficial)
Stars: ✭ 152 (-22.45%)
Mutual labels:  api, library
Coinbasepro Csharp
The unofficial .NET/C# client library for the Coinbase Pro/GDAX API
Stars: ✭ 143 (-27.04%)
Mutual labels:  api, library
Amadeus Node
Node library for the Amadeus Self-Service travel APIs
Stars: ✭ 91 (-53.57%)
Mutual labels:  api, library
Autoserver
Create a full-featured REST/GraphQL API from a configuration file
Stars: ✭ 188 (-4.08%)
Mutual labels:  api, library
Ccxt.net
CCXT.NET – CryptoCurrency eXchange Trading Library for .NET
Stars: ✭ 89 (-54.59%)
Mutual labels:  api, library
Xseries
Library for cross-version Minecraft Bukkit support and various efficient API methods.
Stars: ✭ 109 (-44.39%)
Mutual labels:  api, library
Async Gamequery Lib
A high-performance java game query library designed for steam/source based games and others
Stars: ✭ 88 (-55.1%)
Mutual labels:  api, library
Tik4net
Manage mikrotik routers with .NET C# code via ADO.NET like API or enjoy O/R mapper like highlevel api.
Stars: ✭ 118 (-39.8%)
Mutual labels:  api, library
Best Of Web Python
🏆 A ranked list of awesome python libraries for web development. Updated weekly.
Stars: ✭ 1,118 (+470.41%)
Mutual labels:  api, library
Logging Log4j2
Apache Log4j 2 is an upgrade to Log4j that provides significant improvements over its predecessor, Log4j 1.x, and provides many of the improvements available in Logback while fixing some inherent problems in Logback's architecture.
Stars: ✭ 1,133 (+478.06%)
Mutual labels:  api, library
Archiveis
A simple Python wrapper for the archive.is capturing service
Stars: ✭ 140 (-28.57%)
Mutual labels:  api, news
Riot Api Java
Riot Games API Java Library
Stars: ✭ 184 (-6.12%)
Mutual labels:  api, library

newsapi-python

A Python client for the News API.

License PyPI Status Python

License

Provided under MIT License by Matt Lisivick.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

General

This is a Python client library for News API V2. The functions and methods for this library should mirror the endpoints specified by the News API documentation.

Installation

Installation for the package can be done via pip:

$ python -m pip install newsapi-python

Usage

After installation, import the client class into your project:

from newsapi import NewsApiClient

Initialize the client with your API key:

api = NewsApiClient(api_key='XXXXXXXXXXXXXXXXXXXXXXX')

Endpoints

An instance of NewsApiClient has three instance methods corresponding to three News API endpoints.

Top Headlines

Use .get_top_headlines() to pull from the /top-headlines endpoint:

api.get_top_headlines(sources='bbc-news')

Everything

Use .get_everything() to pull from the /everything endpoint:

api.get_everything(q='bitcoin')

Sources

Use .get_sources() to pull from the /sources endpoint:

api.get_sources()

For Windows users printing to cmd or powershell

You will encounter an error if you attempt to print the .json() object to the command line. This is because the '{', '}' curly braces to be printed to the console. This becomes especially annoying if developers wish to get 'under the hood'.

Here is the error:

UnicodeEncodeError: 'charmap' codec can't encode character '\u2019' in position 1444: character maps to <undefined>

This can be fixed by: - installing 'win-unicode-console' py -mpip install win-unicode-console - then running it while calling your python script... py -mrun myPythonScript.py

Another option is hardcoding your console to only print in utf-8. This is a bad idea, as it could ruin many other scripts and/or make errors MUCH more difficult to track. More information.

Support

Feel free to make suggestions or provide feedback regarding the library. Thanks. Reach out at [email protected]

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].