Wallabag API to add every pages you want to your Wallabag account
Project description
Python API for Wallabag v2.4.2
Requirements :
httpx
Installation:
to get the project, from your virtualenv, do :
git clone https://gitlab.com/foxmask/wallabagapi/
or
pip install wallabagapi
Creating a post :
request the token, if you don’t have it yet
create the post
#!/usr/bin/env python
import httpx
from wallabagapi.wallabag import Wallabag
# settings
my_host = 'http://localhost:8080'
async def main(loop):
params = {'username': 'foxmask',
'password': 'mypass',
'client_id': 'myid',
'client_secret': 'mysecret',
'extension': 'pdf'}
# get a new token
token = await Wallabag.get_token(host=my_host, **params)
wall = Wallabag(host=my_host,
client_secret=params.get('client_secret'),
client_id=params.get('client_id'),
token=token,
extension=params['extension'],
aio_sess=session)
# initializing
async with httpx.AsyncClient() as client:
url = 'https://foxmask.trigger-happy.eu'
title = 'foxmask\'s blog'
await client.post_entries(url, title, '', 0, 0)
url = 'https://trigger-happy.eu'
title = 'Project TrigerHappy'
await wall.post_entries(url, title, '', 0, 0)
# get all the articles
my_wallabag = await wall.get_entries()
all_article = my_wallabag['_embedded']['items']
for article in all_article:
print(article['id'], article['title'])
# get the version of wallabag
version = await wall.version
print(f"version {version}")
# export one article into PDF
my_wallabag = await wall.get_entry_export(entry=1)
with open("foobar.pdf", "wb") as f:
f.write(my_wallabag)
if __name__ == '__main__':
loop = asyncio.get_event_loop()
loop.run_until_complete(main(loop))
this will give you something like this :
Testing :
Install Wallabag V2 on your own host like explain here http://doc.wallabag.org/en/v2/user/installation.html
Then run the development version (with make run)
Then create a client API like explain here http://doc.wallabag.org/en/v2/developer/api.html
this will give you something like this
Then replace the client_id / client_secret / login / pass to wallabag_test.py and run
python wallabag_test.py
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
wallabagapi-1.3.2.tar.gz
(8.5 kB
view hashes)
Built Distribution
Close
Hashes for wallabagapi-1.3.2-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 7cb6ac5f955da90e02e5b3d97058268aaf98f53a9bb5e2ee646dfd4e77606b84 |
|
MD5 | a0bb3e8f708c5a00a02701ac4731d0aa |
|
BLAKE2b-256 | 3f8bbe6c5fca2a046e8f26852f8858e43ce7606602ea0a8da55a291acc4f24f1 |