Skip to main content

HFR API

A Python library to interface with forum.hardware.fr.

Installation

You can install the package using pip:

pip install hfr-api

Usage

Browsing a Category

You can browse topics in a specific category.

from hfr import Category

# Initialize a category (e.g., category 13 for "Discussions")
# See hfr/category.py for a mapping of category IDs
category = Category(13)

# Load the first page of topics
category.load_page(1)

# Iterate through the topics found on that page
for topic in category.topics:
    print(f"Topic ID: {topic.post}, Sticky: {topic.sticky}")
    # Note: Topic title is not available until the topic itself is loaded

Reading a Topic

You can access messages within a topic.

from hfr import Topic

# Initialize a topic with: Category ID, Subcategory ID, Post ID
topic = Topic(cat=13, subcat=432, post=73768)

# Load the first page of the topic
topic.load_page(1)

print(f"Title: {topic.title}")

# Iterate through messages
# Messages are grouped by date (YYYY-MM-DD)
for date_str, messages_dict in topic.messages.items():
    print(f"--- Date: {date_str} ---")
    for msg_id, message in messages_dict.items():
        print(f"[{message.posted_at}] {message.author}:")
        print(message.text)
        print("-" * 20)

CLI

The package includes a command-line interface to interact with the forum.

Installation

You can install the CLI tool using uv or pipx:

uv tool install hfr-api
# or
pipx install hfr-api

Once installed, the hfr command will be available in your path.

Get Topic Info

Retrieve metadata about a topic as JSON.

hfr info <cat> <subcat> <post>
# Example
hfr info 13 432 73768

Dump Topic Content

Dump all messages from a topic (or a specific page) to JSON.

hfr dump <cat> <subcat> <post> <output_file> [--page <page_number>]

# Example: Dump all pages to a file
hfr dump 13 432 73768 my_topic.json

# Example: Dump all pages to stdout
hfr dump 13 432 73768 - > my_topic.json

# Example: Dump only page 1 to a file
hfr dump 13 432 73768 page1.json --page 1

Features

  • Categories: List topics within a forum category.
  • Topics: Read messages, retrieve metadata (page count, dates).
  • Messages: Parse content including BBCode strings.
  • Parsers: Handles HTML parsing from the forum.

Contributing

Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.

Please make sure to update tests as appropriate.

License

MIT

Release files for hfr-api 0.3.2

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

Source distribution (sdist)

Source distribution for hfr-api 0.3.2
File Size Uploaded
hfr_api-0.3.2.tar.gz 77.4 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for hfr-api 0.3.2
File Interpreter ABI Platform
hfr_api-0.3.2-py3-none-any.whl Python 3 none any Details

Total release size: 96.6 kB

Release files / hfr_api-0.3.2.tar.gz

Download URL hfr_api-0.3.2.tar.gz
Size 77.4 kB
Tags Source
SHA-256 checksum
How to use checksums
9c157e0643312d10755dd52f69b84a049a89144889c23054bc865a3667fd5e66
BLAKE2b-256 checksum
How to use checksums
77ba646826ce18afab4df8aece199cb644d19490f77227dc16228c9c4388bba2
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.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 Aug 30, 2026.

Transparency log

Release files / hfr_api-0.3.2-py3-none-any.whl

Download URL hfr_api-0.3.2-py3-none-any.whl
Size 19.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
4db76c9164f0c4e899a69892b6deab791766c505172efed5a2689df5688f775c
BLAKE2b-256 checksum
How to use checksums
656de342a7db276d3abe583f8fd8b02d7ae30267dc8fb34cb14616bb2cf8890f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.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 Aug 30, 2026.

Transparency log

Release history Release notifications | RSS feed

0.3.15

2 release files

0.3.14

2 release files

0.3.13

2 release files

0.3.12

2 release files

0.3.11

2 release files

0.3.10

2 release files

0.3.9

2 release files

0.3.8

2 release files

0.3.7

2 release files

0.3.6

2 release files

0.3.4

2 release files

0.3.3

2 release files

This release

0.3.2 This release

2 release files

0.3.1

2 release files

0.3.0

2 release files

0.2.0

2 release files

0.1.2

2 release files

0.1.1

2 release files

0.1.0

2 release files

0.0.6

2 release files

0.0.5

2 release files

0.0.4

2 release files

0.0.2

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