CRUDs is a simple high level library for Humans, inspired by Python Requests
Project description
CRUDs
CRUDs is a simple high level library for Humans, inspired by Python Requests
>>> import cruds
>>> catfact_ninja = cruds.Client(host="https://catfact.ninja/")
>>> data = catfact_ninja.read("fact")
Interact with RESTful API using Create, Read, Update and Delete requests. Focus on using Python data types instead of worrying about serialization. Authentication, timeouts, retries, and rate limit back-off are all built in and can be adjusted.
Installation
You can install the client using PIP like so.
pip install cruds
Logging
If you want to see logging set the level using the standard logging interface. DEBUG will show you URLLib3, but INFO will give you general information from the cruds.
>>> import logging
>>> import cruds
>>> logging.basicConfig(level=logging.INFO)
Extensibility
The library has been created with extensibility in mind. You can Sub Class Client for example and add the logic requirements needed to make the requests.
from cruds import Client
class CatFactNinja(Client):
"""Cat Fact Ninja Interface"""
_fact_uri = "fact"
def __init__(self, **kwargs):
host = "http://catfact.ninja/"
super().__init__(host=host, **kwargs)
@property
def fact(self):
""" Get a Fact about Cats"""
return self.read(self._fact_uri)
cat = CatFactNinja()
print(cat.fact)
Todo List
- OAuth Client for Authentication
License
cruds is released under the MIT License. See the bundled LICENSE file for details.
Credits
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.