Skip to main content
Pre-release

This release is a pre-release and may not be stable for production use.

usenet

NNTP client and newsgroup-harvesting toolkit for Python. Read and post articles, discover public servers, and harvest groups into a text corpus.

Works on Python 3.9–3.13: nntplib was removed from the standard library in 3.13 (PEP 594), so the standard-nntplib backport is pulled in automatically there.

Install

pip install usenet
# optional: anti-bot + Wayback transport for the legacy server-list scrapers
pip install usenet[scrape]

Quickstart

Read a group:

from datetime import timedelta
from usenet import UsenetServer

with UsenetServer("news.eternal-september.org") as server:
    for article in server.get_new_news("comp.lang.python", since=timedelta(days=7)):
        print(article.subject, article.author, article.date)
        print(article.text)

Post an article (most servers need a free account):

from usenet import UsenetServer

with UsenetServer("news.eternal-september.org", user="login", pswd="secret") as server:
    server.post("this is a test", subject="hello", group="misc.test")

Server discovery

A curated, offline list ships with the package:

from usenet import get_known_servers

for s in get_known_servers():
    print(s.url, s._can_post)

The legacy directory scrapers in usenet.scrappers are a secondary "refresh once" path; their source sites are mostly dead, so with usenet[scrape] installed requests fall back to the Wayback Machine. See examples/.

Dataset

dataset.py harvests a newsgroup into a JSONL corpus (one article per line) for publishing to the Hugging Face Hub. See docs/dataset.md.

python dataset.py comp.lang.python --days 30 --out comp.lang.python.jsonl

Testing

pip install -e .[test]
pytest test/

The unit tests are offline; they exercise article parsing, post framing, the bundled server list, and scraper HTML parsing against fixtures.

License

Apache-2.0

Release files for usenet 0.1.1a1

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

Source distribution (sdist)

Source distribution for usenet 0.1.1a1
File Size Uploaded
usenet-0.1.1a1.tar.gz 14.3 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for usenet 0.1.1a1
File Interpreter ABI Platform
usenet-0.1.1a1-py3-none-any.whl Python 3 none any Details

Total release size: 27.0 kB

Release files / usenet-0.1.1a1.tar.gz

Download URL usenet-0.1.1a1.tar.gz
Size 14.3 kB
Tags Source
SHA-256 checksum
How to use checksums
4b57db2e060176dff8101be2ba16cd43654ac9368aced5463bac72d0aa73d2d9
BLAKE2b-256 checksum
How to use checksums
68e2dee2b95b63050e1bee78fb98889cba4a831d9897ad040d8e268c64968c19
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.14

Release files / usenet-0.1.1a1-py3-none-any.whl

Download URL usenet-0.1.1a1-py3-none-any.whl
Size 12.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
a23764ca1de6df671c792ee108ddd0f4877e6494d68c93d90f432adbcec6d71b
BLAKE2b-256 checksum
How to use checksums
5f8a0d06e949c6524b295ceebe093fa4e871cdac0709d8d049673489cfebe8de
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.14

Release history Release notifications | RSS feed

This release

0.1.1a1 This release

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