Skip to main content

Open_inStreamlit Python PyPi Build CodeFactor License

📰 Streamlit-NewsAPI Data Connector

Connect to NewsAPI from your Streamlit app. Powered by st.experimental_connection(). Works with Streamlit >= 1.22. Read more about Streamlit Connections in the official docs.

Contributions to this repo are welcome. If you are interested in helping to maintain it, reach out to us.

🚀 Quickstart

  1. Clone the repository:
git clone git@github.com:dcarpintero/st-newsapi-connector.git
  1. Create and Activate a Virtual Environment:
Windows:

py -m venv .venv
.venv\scripts\activate

macOS/Linux

python3 -m venv .venv
source .venv/bin/activate
  1. Install dependencies:
pip install -r requirements.txt
  1. Launch Web Application
streamlit run ./app.py

📄 Minimal Integration

# src/app.py

import streamlit as st
from st_newsapi_connector.connection import NewsAPIConnection

conn_newsapi = st.connection("NewsAPI", type=NewsAPIConnection)

# Retrieves News Articles on a specific topic from the NewsAPI
df = conn_newsapi.everything(topic="AI, LLMs")
st.dataframe(df)

# Retrieves Top-Headlines in a country and category from the NewsAPI
df = conn_newsapi.top_headlines(country='US', category='Science')
st.dataframe(df)
# .streamlit/secrets.toml

NEWSAPI_KEY = 'your-newsapi-key'
NEWSAPI_BASE_URL = 'https://newsapi.org/v2/'
# requirements.txt

pandas==1.5.1
pycountry==22.3.5
requests==2.31.0
streamlit==1.28.1

👩‍💻 Streamlit Web App

Demo Web App deployed to Streamlit Cloud and available at https://st-newsapi-connector.streamlit.app/

📚 References

Release files for st-newsapi-connector 0.1.18

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

Source distribution (sdist)

Source distribution for st-newsapi-connector 0.1.18
File Size Uploaded
st-newsapi-connector-0.1.18.tar.gz 5.0 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for st-newsapi-connector 0.1.18
File Interpreter ABI Platform
st_newsapi_connector-0.1.18-py3-none-any.whl Python 3 none any Details

Total release size: 10.0 kB

Release files / st-newsapi-connector-0.1.18.tar.gz

Download URL st-newsapi-connector-0.1.18.tar.gz
Size 5.0 kB
Tags Source
SHA-256 checksum
How to use checksums
80f86805784ac16ae7709ea48d2a6437f74c02d9478536e4e8add3f3568e970e
BLAKE2b-256 checksum
How to use checksums
80bb93d672c24e94f7a0bab48e7b967a28172771685dfa97d76869c509263490
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.1.6 CPython/3.8.3 Windows/10

Release files / st_newsapi_connector-0.1.18-py3-none-any.whl

Download URL st_newsapi_connector-0.1.18-py3-none-any.whl
Size 5.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
1fee2bb13fa6a01dfc0a1eebbfea73d29004b30517bc415b65a43f34fd01d4f3
BLAKE2b-256 checksum
How to use checksums
386464011bc65a114e156fb102c321d47aad98e964e2ba89c56ecf8b9195b730
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.1.6 CPython/3.8.3 Windows/10

Release history Release notifications | RSS feed

This release

0.1.18 This release

2 release files

0.1.8

2 release files

0.1.7

2 release files

0.1.6

2 release files

0.1.5

2 release files

0.1.4

2 release files

0.1.3

2 release files

0.1.2

2 release files

0.1.1

2 release files

0.1.0

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