Skip to content
A versatile tool for cleaner integrations.
Python
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
.github/ISSUE_TEMPLATE
dist
docs
ergal
tests
.gitignore
.travis.yml
LICENSE
README.md
poetry.lock
pyproject.toml
setup.py

README.md

Ergal

Build Status GitHub

API integrations can be cumbersome and messy, and Ergal makes this process cleaner and more efficient by enabling the user to create, manage, and access simple API profiles stored in a lightweight SQLite database.

The Ergal calling structure is also fully async, making it significantly faster and more efficient than traditional linear implementations.

Ergal is a derivation of the Greek word εργαλείο (ergaleío), meaning tool.

Goals

  • Concise integrations
  • Cleaner codebases
  • Faster API interactions

Standard Installation

pip install ergal

Requirements

Quickstart

Python Shell

Before we can access an API (we'll use httpbin.com in this case), we have to add an API Profile. To create an API profile, we'll use the Profile class from ergal.profile.

>>> from ergal import Profile
>>> profile = Profile('HTTPBin', base='https://httbin.org')
Profile for 'HTTPBin' created on e74afb669fb45b58a6c742b83f624166.

A new row has been created in the local ergal.db database to house the API profile's information.

Now that the profile has been created, we'll need to add an endpoint, and to do so, we'll use the add_endpoint method, and supply it with a name, path, and method.

>>> profile.add_endpoint('Get JSON', '/json', 'get')
Endpoint 'Get JSON' for 'HTTPBin' added on e74afb669fb45b58a6c742b83f624166.

With an endpoint added, we can make the call. To do that, we'll use the call method. All we need to supply is the name of the endpoint we just added, and ergal will do the rest.

>>> asyncio.run(profile.call('Get JSON'))
<Response [200]>

Hooray! Now we can do whatever we want with our cleaned up and easy-to-work-with dictionary of response data.

Ergal CLI

You can also now use the Ergal CLI:

$ python -m ergal.cli

Contribution

As per most open source projects, submitted code needs to be continuous with the rest in style, it needs to be as succinct and readable as it can be, and it has to serve a real purpose according to the objectives of this project.

Development Setup

First, fork the master repository. Then, do this:

git clone https://github.com/<your username>/ergal
cd ergal
poetry install

Development Requirements

Recommended Tools

  • pyenv (preferred venv manager)
You can’t perform that action at this time.