The news client written in Python that fetches and curates the world news across the web.
Project description
Newspy
The news client written in Python that fetches and curates the world news across the web.
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
- News API. Requires API Key from: https://newsapi.org/
- RSS feeds
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
Get the news from Newsorg API and RSS Feeds
import newspy.client as newspy
newsorg_api_key = "YOUR_NEWSORG_KEY"
newspy.configure(newsorg_api_key=newsorg_api_key)
news_articles = newspy.get_articles()
print(news_articles)
news_sources = newspy.get_sources()
print(news_sources)
Get the news from Newsorg API
import newspy.client as newspy
from newspy import newsorg
from newspy.newsorg.models import NewsorgEndpoint
newsorg_api_key = "YOUR_NEWSORG_KEY"
newspy.configure(newsorg_api_key=newsorg_api_key)
newsorg_articles = newsorg.get_articles(
endpoint=NewsorgEndpoint.TOP_HEADLINES,
search_text="bitcoin",
)
print(newsorg_articles)
Get the news from RSS Feeds
from newspy import rss
rss_articles = rss.get_articles()
print(rss_articles)
Contributing
Want to contribute? Read our contribution guideline.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
newspy-2.1.0.tar.gz
(8.7 kB
view hashes)
Built Distribution
newspy-2.1.0-py3-none-any.whl
(11.6 kB
view hashes)