hnx
Modern async Hacker News API client for Python.
hnx combines the Hacker News Firebase API & Algolia's search API to provide a unified, fully-typed interface for working with stories, comments, users, & discussion threads.
Table of Contents
Features
- Async-first API built on
httpx - Fully typed Pydantic models combining data from both Algolia & Firebase APIs
- Individual and concurrent batch item retrieval
Installation
Requires Python 3.10 or higher.
pip
pip install hnx
uv
uv add hnx
Poetry
poetry add hnx
Pipenv
pipenv install hnx
Quick Start
Fetch a Story
from hnx import HackerNews
async def main():
async with HackerNews() as hn:
story = await hn.item(44321234)
print(story.title)
print(story.score)
Fetch Top Stories
from hnx import HackerNews
async def main():
async with HackerNews() as hn:
ids = await hn.top()
print(ids[:10])
Fetch a Complete Thread
from hnx import HackerNews
async def main():
async with HackerNews() as hn:
thread = await hn.thread(44321234)
print(thread.root.title)
print(thread.comment_count)
for comment in thread.comments:
print(comment.author)
Documentation
Complete documentation, API reference, guides, and examples are available at:
License
Metadata
Release files for hnx 0.5.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| hnx-0.5.1.tar.gz | 5.0 kB | Without provenance | Details for hnx-0.5.1.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| hnx-0.5.1-py3-none-any.whl | Python 3 | none | any | Details for hnx-0.5.1-py3-none-any.whl |
Total release size: 14.1 kB
Release files / hnx-0.5.1.tar.gz
| Download URL | hnx-0.5.1.tar.gz |
|---|---|
| Size | 5.0 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
b320410b552bde43f1890dd634b05a3b674aa7c3afa99c32598f10c2012feced
|
|
BLAKE2b-256 checksum How to use checksums |
28e32a4dd68a6ed3c8c62833e78cf39f41e3231ac5c11cdd5294e01612218c52
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.10.19
|
Release files / hnx-0.5.1-py3-none-any.whl
| Download URL | hnx-0.5.1-py3-none-any.whl |
|---|---|
| Size | 9.0 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
13119c09a5ebe0030cf4e474bfa0b1e71cd916aea4695b455597e4dcff1877be
|
|
BLAKE2b-256 checksum How to use checksums |
f13c2cf1fc3b93be4543d1bea01295700f0c2cabeaecf206ad5f8d60f0b2d35f
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.10.19
|
Security for hnx 0.5.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.