Skip to main content

A Python SDK for FreeApiHub, providing simple access to free APIs with support for data retrieval and integration.

Project description

FreeApiHub SDK (Python)

A Python SDK for FreeApiHub, providing simple access to free APIs with support for data retrieval and integration. Ideal for Python projects needing quick API access.

Features

  • Simple API calls to interact with different endpoints (e.g., books, jokes, quotes).
  • Lightweight and efficient implementation using httpx.
  • Simple integration into your Python projects.

🚀 Docs

FreeApiHub API Documentation: FreeApiHub Docs

Requirements

  • Python 3.7+
  • httpx (installed automatically with pip install freeapihub)

Installation

Install the SDK using pip:

Using pip

pip install freeapihub

Usage

Import the SDK

In a Python file, import the necessary functions.

from freeapihub import get_all_books, get_book_by_id

Example 1: Fetching all books

import asyncio
from freeapihub import get_all_books

async def fetch_books():
    try:
        books = await get_all_books()
        print(books)
    except Exception as e:
        print(f"Error fetching books: {e}")

asyncio.run(fetch_books())

Example 2: Fetch a Book by ID

import asyncio
from freeapihub import get_book_by_id

async def fetch_book(book_id: str):
    try:
        book = await get_book_by_id(book_id)
        print(book)
    except Exception as e:
        print(f"Error fetching book with ID {book_id}: {e}")

asyncio.run(fetch_book("book-id-here"))

Available Methods

  • get_all_jokes(): Fetches all jokes from the API.
  • get_joke_by_id(joke_id: str): Fetches a joke by its ID.
  • get_all_books(): Fetches all books from the API.
  • get_book_by_id(book_id: str): Fetches a book by its ID.
  • get_all_users(): Fetches all users from the API.
  • get_user_by_id(user_id: str): Fetches a user by their ID.
  • get_all_stocks(): Fetches all stock data.
  • get_stock_by_id(stock_id: str): Fetches stock data by its ID.
  • get_all_quotes(): Fetches all quotes.
  • get_quote_by_id(quote_id: str): Fetches a quote by its ID.
  • get_all_products(): Fetches all products.
  • get_product_by_id(product_id: str): Fetches a product by its ID.
  • get_all_programming_languages(): Fetches all programming languages.
  • get_programming_language_by_id(language_id: str): Fetches a programming language by its ID.

API Documentation

For detailed documentation on each API endpoint, refer to the FreeApiHub API documentation.

Contributing

Contributions are welcome! Feel free to submit issues or pull requests on GitHub.

Author

Created by Rehan

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

freeapihub-0.0.1.tar.gz (9.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

freeapihub-0.0.1-py3-none-any.whl (11.1 kB view details)

Uploaded Python 3

File details

Details for the file freeapihub-0.0.1.tar.gz.

File metadata

  • Download URL: freeapihub-0.0.1.tar.gz
  • Upload date:
  • Size: 9.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.2

File hashes

Hashes for freeapihub-0.0.1.tar.gz
Algorithm Hash digest
SHA256 8503ac33550de016c3f66f64f8f6e40ab4d44f3f65781987200916c67570d7c9
MD5 0964877f516c78a9430fdfa269a230e1
BLAKE2b-256 96e48ec958ab7ce07fb6937ce9cb2e01de1bc9e17ca2e5b126fc7ab87f3a1331

See more details on using hashes here.

File details

Details for the file freeapihub-0.0.1-py3-none-any.whl.

File metadata

  • Download URL: freeapihub-0.0.1-py3-none-any.whl
  • Upload date:
  • Size: 11.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.2

File hashes

Hashes for freeapihub-0.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 088d3d3fd1fe5b7dc549b1580b34599c680831e28870152c9ea3f1db57d627d7
MD5 23367b2a63dde2a5a4da811e113b43ed
BLAKE2b-256 2e7ff31d9a5ca094ecc569288e62f1ab64feeb57bed06f3da6cedcc8de6f584b

See more details on using hashes here.

Supported by

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