Skip to main content

Create HTTP client from pydoc

Project description


.. image::

.. image::

.. image::

.. image::

| Build client for Web APIs from pydoc. Inspired by `Uplink <>`_.

| Doclink turns a Python function into HTTP API by writting pydoc to declare the api meta.
| It is based on Requests and uses YAML with predefined schema as api declaration.
| When calling the function, response from HTTP API will be passed in as a parameter for futher handling.

* create python function as HTTP API with **pydoc**
* **YAML** based schema for api declaration
* handle api response in the **same** function
* response hook as **middleware**
* **all** args for Requests supported
* select base_uri dynamicly from simple **router**

Quick through, with httpbin
Create a consumer instance.

.. code-block:: python

from doclink import Consumer

consumer = Consumer('')

Add response hook(middleware).

.. code-block:: python

def json_hook(resp):
resp.json = resp.json()

Add function for api declaration.

.. code-block:: python

def get(resp):
- arg1: arg1
- arg2: arg2
return resp.json['args']

Use you api.

.. code-block:: python

>>> get()
"arg1": "arg1",
"arg2": "arg2"

Project details

Download files

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

Filename, size & hash SHA256 hash help File type Python version Upload date
doclink-1.1.0-py2.py3-none-any.whl (16.3 kB) Copy SHA256 hash SHA256 Wheel py2.py3
doclink-1.1.0.tar.gz (10.5 kB) Copy SHA256 hash SHA256 Source None

Supported by

Elastic Elastic Search Pingdom Pingdom Monitoring Google Google BigQuery Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN SignalFx SignalFx Supporter DigiCert DigiCert EV certificate StatusPage StatusPage Status page