*******
Doclink
*******
.. image:: https://travis-ci.org/Luoyufu/doclink.svg?branch=master
:target: https://travis-ci.org/Luoyufu/doclink
.. image:: https://codecov.io/gh/Luoyufu/doclink/branch/master/graph/badge.svg
:target: https://codecov.io/gh/Luoyufu/doclink
.. image:: https://img.shields.io/pypi/v/doclink.svg
:target: https://pypi.python.org/pypi/doclink
.. image:: https://img.shields.io/pypi/pyversions/doclink.svg
:target: https://pypi.python.org/pypi/doclink
| Build client for Web APIs from pydoc. Inspired by `Uplink <https://github.com/prkumar/uplink>`_.
Overview
========
| 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.
Features
========
* 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('http://httpbin.org/')
Add response hook(middleware).
.. code-block:: python
@consumer.resp_hook
def json_hook(resp):
resp.json = resp.json()
Add function for api declaration.
.. code-block:: python
@consumer.get('get')
def get(resp):
"""
<meta>
args:
query:
- arg1: arg1
- arg2: arg2
</meta>
"""
return resp.json['args']
Use you api.
.. code-block:: python
>>> get()
{
"arg1": "arg1",
"arg2": "arg2"
}
Metadata
Release files for doclink 1.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| doclink-1.1.0.tar.gz | 10.5 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| doclink-1.1.0-py2.py3-none-any.whl | Python 2, Python 3 | none | any | Details |
Total release size: 26.8 kB
Release files / doclink-1.1.0.tar.gz
| Download URL | doclink-1.1.0.tar.gz |
|---|---|
| Size | 10.5 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
35ce6b522a4d38c47445f74367560d08e43f369abac6bcb4b8c349988a91ad7f
|
|
BLAKE2b-256 checksum How to use checksums |
e2096e71a3462518343a1137e50d6f843dba7044ffc62f7e3b0c069e4a7a54b9
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
Release files / doclink-1.1.0-py2.py3-none-any.whl
| Download URL | doclink-1.1.0-py2.py3-none-any.whl |
|---|---|
| Size | 16.3 kB |
| Tags | Python 2 Python 3 |
|
SHA-256 checksum How to use checksums |
de509a3245c5ffceca3de4272c7b7c9f884209b999279d700fa4faf85e15d3db
|
|
BLAKE2b-256 checksum How to use checksums |
3ee42ec88888d2379c8638b0b3c9a18d79c21ded0f1de109894545374370d5a2
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |