Skip to content

nwithan8/objectrest

Repository files navigation

ObjectREST

PyPi License

Tests Open Issues Closed Issues Latest Release

Discord Twitter

A Python package to handle REST API requests, JSON parsing, and pydantic object generation.

Installation

From PyPi: python -m pip install objectrest

From GitHub python -m pip install git+https://github.com/nwithan8/objectrest.git

Usage

This package acts as a middle-man between the user and the Requests library.

Users can call to methods directly, or use the RequestHandler class to set universal parameters (i.e. API tokens), universal headers and/or a universal base URL for all requests

Users can retrieve the raw request, the JSON data from a request, or have the JSON data automatically parsed into a Pydantic model.

Example:

from objectrest import RequestHandler

requests = RequestHandler(base_url="http://rootoftheapi", universal_parameters={'api_key': "thisisanapikey"})

my_object = requests.get_object(url="/object", model=MyObjectClass, params={"limit": 10})

Documentation

Documentation available on ReadTheDocs

About

A Python package to handle REST API requests, JSON parsing and pydantic object generation

Resources

License

Stars

Watchers

Forks

Packages

No packages published