From a64d8ac5231b786addba6860a77d5cdd256f9a92 Mon Sep 17 00:00:00 2001 From: Olivier Demah Date: Fri, 22 Apr 2016 12:09:29 +0200 Subject: [PATCH] some docs --- README.rst | 53 +++++++++++++++++++++++++++++++++++++++++++++++++---- 1 file changed, 49 insertions(+), 4 deletions(-) diff --git a/README.rst b/README.rst index c6708ec..302eb75 100644 --- a/README.rst +++ b/README.rst @@ -7,7 +7,7 @@ Python API for Wallabag v2 Requirements : ============== -* requests == 2.5.0 +* requests 2.5.0 Installation: @@ -20,6 +20,48 @@ to get the project, from your virtualenv, do : git clone https://github.com/foxmask/wallabag-api/ +or + +.. code:: python + + pip install wallabag_api + + + +Creating a post : +================= + +1) request the token, if you don't have it yet +2) create the post + +.. code:: python + + from wallabag_api.wallabag import Wallabag + # settings + params = {'username': 'foxmask', + 'password': 'mypass', + 'client_id': 'myid', + 'client_secret': 'mysecret'} + my_host = 'http://localhost:8080' + # get token + token = Wallabag.get_token(host=my_host, **params) + + # create a post + wall = Wallabag(host=my_host, client_secret='mysecret', client_id='myid', token=token) + + my_url = 'https://blog.trigger-happy.eu' + my_title = 'Trigger Happy blog' + my_tags = ['python', 'wallabag'] + + wall.post_entries(url=my_url, title=my_title, tags=my_tags) + + +this will give you something like this : + +.. image:: https://github.com/foxmask/wallabag_api/blob/master/wallabag.png + + + Testing : ========= @@ -27,11 +69,14 @@ Install Wallabag V2 on your own host like explain here http://doc.wallabag.org/e Then create a client API like explain here http://doc.wallabag.org/en/v2/developer/api.html +this will give you somthing like this + +.. image:: https://github.com/foxmask/wallabag_api/blob/master/wallabag_api_key.png + Then replace the client_id / client_secret / login / pass to wallabag_test.py and run -``` python +.. code:: python -python wallabag_test.py + python wallabag_test.py -```