Skip to content

Commit

Permalink
Prepare for 0.3.3 release
Browse files Browse the repository at this point in the history
  • Loading branch information
Kamil Niechajewicz committed Sep 20, 2016
1 parent 7a875ec commit c836e7c
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 3 deletions.
25 changes: 24 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,9 @@ Devourer is a generic REST API client for Python 2.7 and 3.3+.
You can also subclass it to wrap a set of system calls, FFI or a messy dependency.

It features an object-oriented, declarative approach to simplify the communication.
It depends on the brilliant requests package as the gateway to API server. A simple example:
It depends on the brilliant requests package as the gateway to API server.

### Basic usage

```python
from devourer import GenericAPI, APIMethod, APIError
Expand Down Expand Up @@ -45,6 +47,27 @@ The init function gives details so you don't need to repeat them elsewhere, enab
raising exceptions on error. You can also obtain raw string with `load_json=False` and silence errors getting
None instead when they happen with `throw_on_error=False`.

### Async usage

If you want to use non-blocking calls, put following attribute in API class declaration:

```python
class AsyncTestApi(GenericAPI):
generate_async_methods = True
posts = APIMethod('get', 'posts/')
```

This will generate additional async method for each defined APIMethod attribute, appending '_async' to the name.
In the above example, two methods will be generated: `posts()` and `posts_async()`. The former one returns parsed
JSON or string containing API response, while the latter returns AsyncRequest object, which can be later queried for
the result:

```python
api = AsyncTestApi()
posts_r = api.posts_async() # send HTTP request, but don't block
posts = posts_r.result() # retrieve result, blocking if the request hasn't finished yet
```

Installation
------------
You can just `pip install devourer`.
Expand Down
5 changes: 3 additions & 2 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +3,18 @@
setup(
name='devourer',
packages=['devourer'],
version='0.3.2',
version='0.3.3',
install_requires=[
'requests',
'gevent',
'six',
],
description='Devourer is a generic API client.'
'It features an object-oriented, declarative approach to simplify the communication.',
author='Bonnier Business Polska / Krzysztof Bujniewicz',
author_email='racech@gmail.com',
url='https://github.com/bonnierpolska/devourer',
download_url='https://github.com/bonnierpolska/devourer/tarball/0.3.2',
download_url='https://github.com/bonnierpolska/devourer/tarball/0.3.3',
keywords=['api', 'generic api', 'api client'],
classifiers=[]
)

0 comments on commit c836e7c

Please sign in to comment.