Skip to main content

HackForums API v2 Integration

Project description

Purpose

Other public Python implementations of the HackForums API have shown to be immature or varying levels of incomplete. The goal of this project is to provide a fully usable Python API for Hackforums available through pip. hfapi features include: - Read/Write profile user profile information - Easy and intuitive integration with Python network applications - Synchronous (requests) and Asynchronous (aiohttp) implementations - All API objects are defined with Pydantic

How-To: Install

Installation is easy!

python3 -m pip install -U hfapi

How-To Use

The synchronous and asynchronous API implementations are identical in functionality and usage with the addition of await syntax in the asynchronous version.

# use "HFApp" and "HFClient" for synchronous
from hfapi import HFAppAsync, HFClientAsync

app = """ EXAMPLE WEB SERVER HERE """

hf = HFAppAsync(
    client_id="[CLIENT_ID]",
    secret_key="[SECRET_KEY]",
    redirect_uri="https://example.com/authorize",
)

# Hackforums will submit a GET request with "code" as a parameter
@app.get("/authorize")
async def authorize(code: str):
    # use the `hf.authorize` method to create a client session
    client = await hf.authorize(code)
    me = await client.me(all=True)  # collect all (possible) data from current user
    return me.dict()

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

hfapi-0.1b0.tar.gz (1.9 kB view hashes)

Uploaded Source

Built Distribution

hfapi-0.1b0-py3-none-any.whl (14.2 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page