some docs
This commit is contained in:
53
README.rst
53
README.rst
@@ -7,7 +7,7 @@ Python API for Wallabag v2
|
|||||||
Requirements :
|
Requirements :
|
||||||
==============
|
==============
|
||||||
|
|
||||||
* requests == 2.5.0
|
* requests 2.5.0
|
||||||
|
|
||||||
|
|
||||||
Installation:
|
Installation:
|
||||||
@@ -20,6 +20,48 @@ to get the project, from your virtualenv, do :
|
|||||||
git clone https://github.com/foxmask/wallabag-api/
|
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 :
|
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
|
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
|
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
|
||||||
|
|
||||||
```
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user