Skip to main content

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

Project description

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

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

news-python-1.0.0.tar.gz (2.7 kB view details)

Uploaded Source

Built Distribution

news_python-1.0.0-py3-none-any.whl (16.2 kB view details)

Uploaded Python 3

File details

Details for the file news-python-1.0.0.tar.gz.

File metadata

  • Download URL: news-python-1.0.0.tar.gz
  • Upload date:
  • Size: 2.7 kB
  • Tags: Source
  • Uploaded using 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

File hashes

Hashes for news-python-1.0.0.tar.gz
Algorithm Hash digest
SHA256 ed694bc69a302049b60d4e98c8661a1f9b94f36a71d8ee92b2a96d9ff3aaac53
MD5 7696969de7c6ac5198229f93e8a29351
BLAKE2b-256 f782e347bc401f037a3b8e4754381308a69999cd3b665421ebe0a44ffb1c5f82

See more details on using hashes here.

File details

Details for the file news_python-1.0.0-py3-none-any.whl.

File metadata

  • Download URL: news_python-1.0.0-py3-none-any.whl
  • Upload date:
  • Size: 16.2 kB
  • Tags: Python 3
  • Uploaded using 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

File hashes

Hashes for news_python-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 a678310ff57a3698d98d31ea8171966f95f83fb09b99871fbb371db1649c7d9b
MD5 2b5b268c6a6c74b036892ab3e3bf73a1
BLAKE2b-256 a25ab37fcb1a1119e5386c49f13154ff98605b98fb8d4f8fb075b362e44e1db1

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page