Skip to main content

newsheadlines

Python package to fetch the latest news headlines from major news outlets by parsing their webpages.

ℹ️ Every response is cached for 10 minutes before a new request is made.

Installation

The latest version can be installed via pip:

pip install newsheadlines

Documentation

class Headline

A dataclass representing a single news headline.

Field Type Description
title str The headline text
source str Source identifier (e.g. "bbc")
url str | None Link to the full article, if available

newsheadlines.all(source_name)

Returns a list of all Headline objects from the given source.

Parameters

  • source_name (str) - one of the supported source keys (case-insensitive)

Returns

  • list[Headline]

Example

import newsheadlines

headlines = newsheadlines.all("bbc")

for h in headlines:
    print(h.title)
    print(h.url)
    print(h.source)

newsheadlines.main(source_name)

Returns only the top/main Headline from the given source.

Parameters

  • source_name (str) - one of the supported source keys (case-insensitive)

Returns

  • Headline

Example

import newsheadlines

headline = newsheadlines.main("bbc")

print(headline.title)
print(headline.url)
print(headline.source)

Available sources

Key Source
"apnews" AP News
"bbc" BBC News
"cnn" CNN
"nyt" The New York Times
"theguardian" The Guardian

Metadata

Release files for newsheadlines 0.0.3

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

Source distribution (sdist)

Source distribution for newsheadlines 0.0.3
File Size Uploaded Provenance Actions
newsheadlines-0.0.3.tar.gz 6.7 kB With provenance Details for newsheadlines-0.0.3.tar.gz

Built distribution (wheel)

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

Total release size: 15.3 kB

Release files / newsheadlines-0.0.3.tar.gz

Download URL newsheadlines-0.0.3.tar.gz
Size 6.7 kB
Tags Source
SHA-256 checksum
How to use checksums
53698236919a936748fcddbd4148b17bc0950aae56349e3c94085c2744d28ede
BLAKE2b-256 checksum
How to use checksums
645811141d64c71b189dae9dbd6ebe4f7a8358da1925e4c1bfbdf0b612557c5e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.14

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Jul 23, 2026.

Transparency log

Release files / newsheadlines-0.0.3-py3-none-any.whl

Download URL newsheadlines-0.0.3-py3-none-any.whl
Size 8.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
b120e1d904c004c1c986d516564469d6269849cfade108cba294ae65b1e05d7d
BLAKE2b-256 checksum
How to use checksums
049c86cb494eee0c98a6fa42cb80983c2e22ef86b768520d53fc621f4a16dc9d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.14

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Jul 23, 2026.

Transparency log

Security for newsheadlines 0.0.3

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.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for newsheadlines-0.0.3.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Jul 23, 2026.

Transparency log

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