Skip to main content

Newspy

The news client written in Python that fetches and curates the world news across the web.


PyPI - Version GitHub PyPI - Python Version Static Badge Codecov GitHub Workflow Status (with event)


Table of contents

Requirements

  • Python 3.10+
  • Poetry 1.4.0+ (for dependency management)
  • yarn (for the semantic-release versioning)
  • API Key from the New API Organisation: https://newsapi.org/

News Sources

Basic usage

Create virtual environment

python -m venv .venv

# Activate virtual environment
.venv/bin/activate # Linux or MacOS
.venv/Script/activate # Windows


# Install
pip install newspy

RSS feeds client

Get available news sources from RSS feeds

from newspy import rss

rss_sources = rss.get_sources()
print(rss_sources)

Get articles from RSS feeds

rss_articles = rss.get_articles()
print(rss_articles)

Newsorg client

Configure your Newsorg API key

You can get one here: https://newsapi.org/

import newspy.client as newspy

newsorg_api_key = "YOUR_NEWSORG_KEY"
newspy.configure(newsorg_api_key=newsorg_api_key)

Get available news sources from Newsorg

from newspy import newsorg

newsorg_sources = newsorg.get_sources()
print(newsorg_sources)

Get articles from Newsorg

from newspy import newsorg
from newspy.newsorg.models import NewsorgEndpoint

newsorg_articles = newsorg.get_articles(
    endpoint=NewsorgEndpoint.TOP_HEADLINES,
    search_text="bitcoin",
)

print(newsorg_articles)

Newspy client

The newspy client makes it convenient to get articles from both the RSS feeds and Newsorg APIs.

Configure your Newsapi API key

import newspy.client as newspy

newsorg_api_key = "YOUR_NEWSORG_KEY"
newspy.configure(newsorg_api_key=newsorg_api_key)

Get available news sources from both RSS feeds and Newsorg

import newspy.client as newspy

news_sources = newspy.get_sources()
print(news_sources)

Get articles from both RSS feeds and Newsorg

import newspy.client as newspy

news_articles = newspy.get_articles()
print(news_articles)

Examples

See the examples directory for more examples.

Contributing

Want to contribute? Read our contribution guideline.

Metadata

Release files for newspy 2.2.23.1

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

Source distribution (sdist)

Source distribution for newspy 2.2.23.1
File Size Uploaded Provenance Actions
newspy-2.2.23.1.tar.gz 10.2 kB Without provenance Details for newspy-2.2.23.1.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for newspy 2.2.23.1
File Interpreter ABI Platform Actions
newspy-2.2.23.1-py3-none-any.whl Python 3 none any Details for newspy-2.2.23.1-py3-none-any.whl

Total release size: 23.6 kB

Release files / newspy-2.2.23.1.tar.gz

Download URL newspy-2.2.23.1.tar.gz
Size 10.2 kB
Tags Source
SHA-256 checksum
How to use checksums
96f28a4ecc51b1c646d71b829b373fd869165adb5edd468d8bce39996113b614
BLAKE2b-256 checksum
How to use checksums
91e5bf94150b9520bb820850564ea0ad7e0a48d435c6996cccd6a021ed934e8b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/2.4.1 CPython/3.14.7 Linux/6.17.0-1022-azure

Release files / newspy-2.2.23.1-py3-none-any.whl

Download URL newspy-2.2.23.1-py3-none-any.whl
Size 13.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
ed01c75ac16e19b780e1d062029f35bbf413f06249deaa4e354bb1de331abdda
BLAKE2b-256 checksum
How to use checksums
d885e2927d0fb7f9c0e85b0a6ff24608e817e676f1fb3a0b54281fd3edc7fc38
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/2.4.1 CPython/3.14.7 Linux/6.17.0-1022-azure

Security for newspy 2.2.23.1

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

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