Skip to main content

news-python

A Python API Wrapper for the https://newsapi.org/ JSON API

Installation

To install news-python, simply use:

pip install news-python

Usage

import news_python

news = news_python.Global(key="API-KEY")
news_content = news.get_news(query="bitcoin", source="cnn")

print(f"Title: {news_content.title}\n"
      f"URL: {news_content.url}\n"
      f"Author: {news_content.author}")

More can be found in the docs or in the examples folder

Errors

The module will raise KeyError if the API key is wrong

The module will raise ValueError if the API can't find anything about the searched topic or country

Release files for news-python 1.0.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for news-python 1.0.0
File Size Uploaded
news-python-1.0.0.tar.gz 2.7 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for news-python 1.0.0
File Interpreter ABI Platform
news_python-1.0.0-py3-none-any.whl Python 3 none any Details

Total release size: 18.9 kB

Release files / news-python-1.0.0.tar.gz

Download URL news-python-1.0.0.tar.gz
Size 2.7 kB
Tags Source
SHA-256 checksum
How to use checksums
ed694bc69a302049b60d4e98c8661a1f9b94f36a71d8ee92b2a96d9ff3aaac53
BLAKE2b-256 checksum
How to use checksums
f782e347bc401f037a3b8e4754381308a69999cd3b665421ebe0a44ffb1c5f82
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.2.0 pkginfo/1.6.1 requests/2.25.0 setuptools/50.3.2 requests-toolbelt/0.9.1 tqdm/4.51.0 CPython/3.8.1

Release files / news_python-1.0.0-py3-none-any.whl

Download URL news_python-1.0.0-py3-none-any.whl
Size 16.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
a678310ff57a3698d98d31ea8171966f95f83fb09b99871fbb371db1649c7d9b
BLAKE2b-256 checksum
How to use checksums
a25ab37fcb1a1119e5386c49f13154ff98605b98fb8d4f8fb075b362e44e1db1
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.2.0 pkginfo/1.6.1 requests/2.25.0 setuptools/50.3.2 requests-toolbelt/0.9.1 tqdm/4.51.0 CPython/3.8.1

Release history Release notifications | RSS feed

This release

1.0.0 This release

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page