java deda_apiwrapper-简单API包装-Ardy Dedase Overview Installation Getting started with a simple request...

作者:Ardy Dedase

### 作者邮箱:ardy.dedase@gmail.com

### 首页:https://github.com/ardydedase/apiwrapper

### 文档:None

### 下载链接 None

=================================

API Wrapper

.. image:: https://api.travis-ci.org/ardydedase/apiwrapper.svg :target: https://travis-ci.org/ardydedase/apiwrapper

.. image:: https://img.shields.io/pypi/v/apiwrapper.svg :target: https://pypi.python.org/pypi/apiwrapper

.. image:: https://readthedocs.org/projects/apiwrapper/badge/?version=latest :target: https://readthedocs.org/projects/apiwrapper/?badge=latest :alt: Documentation Status

Simple API Wrapper

Free software: BSD license

Documentation: https://apiwrapper.readthedocs.org.

Overview

Recently noticed a pattern and repeated pieces of code in Python API wrappers for simple requests and polling. A separate Python package will minimize code duplication and encourage de-coupling of logic from the API request functions.

Installation

At the command line::

$ easy_install apiwrapper

Or, if you have virtualenvwrapper installed::

$ mkvirtualenv apiwrapper

$ pip install apiwrapper

Getting started with a simple request

.. code:: python

# as a helper class

from apiwrapper import APIWrapper

my_api = APIWrapper()

url = 'https://api.github.com/users/ardydedase/repos'

resp = my_api.make_request(url=url)

print(resp)

# as a parent class

class GithubAPI(APIWrapper):

def get_repos(self, username):

"""

Uses `make_request` method

"""

url = "https://api.github.com/users/{username}/repos".format(username=username)

return self.make_request(url, method='get', headers=None, data=None, callback=None)

More features including polling

Read the docs: https://apiwrapper.readthedocs.org/en/latest/usage.html

Or use apiwrapper/apiwrapper.py as a reference. Implementation is straightforward.

History

0.1.0 (2015-01-11)

First release on PyPI.

Copy from pypi.org

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值