update of API fixed #9 post_entries content parameter

This commit is contained in:
FoxMaSk
2018-05-27 11:20:02 +02:00
parent e892d3ceeb
commit 9e5fdb1c50
5 changed files with 26 additions and 9 deletions

View File

@@ -1,2 +1,2 @@
VERSION = (1, 1, 3) # PEP 386
VERSION = (1, 1, 4) # PEP 386
__version__ = ".".join([str(x) for x in VERSION])

View File

@@ -157,7 +157,8 @@ class Wallabag(object):
return self.query(path, "get", **params)
def post_entries(self, url, title='', tags='', starred=0, archive=0):
def post_entries(self, url, title='', tags='', starred=0, archive=0, content='', language='', published_at='',
authors='', public=1, original_url=''):
"""
POST /api/entries.{_format}
@@ -168,10 +169,18 @@ class Wallabag(object):
:param tags: tag1,tag2,tag3 a comma-separated list of tags.
:param starred entry already starred
:param archive entry already archived
:param content additionnal html content
:param language
:param published_at
:param authors
:param public
:param original_url
:return result
"""
params = {'access_token': self.token, 'url': url, 'title': title,
'tags': tags, 'starred': starred, 'archive': archive}
'tags': tags, 'starred': starred, 'archive': archive,
'content': content, 'language': language, 'published_at': published_at,
'authors': authors, 'public': public, 'original_url': original_url}
if len(tags) > 0 and isinstance(tags, list):
params['tags'] = ', '.join(tags)
path = '/api/entries.{ext}'.format(ext=self.format)

View File

@@ -1,4 +1,5 @@
# coding: utf-8
import datetime
import unittest
from wallabag import Wallabag
@@ -31,11 +32,18 @@ class TestWallabag(unittest.TestCase):
def create_entry(self):
title = 'foobar title'
url = 'https://trigger-happy.eu/'
url = 'https://somwhere.over.the.raibow.com/'
tags = ['foo', 'bar']
starred = 0
archive = 0
data = self.w.post_entries(url, title, tags, starred, archive)
content = '<p>Additional content</p>'
language = 'FR'
published_at = datetime.datetime.now()
authors = 'John Doe'
public = 0
original_url = 'http://localhost'
data = self.w.post_entries(url, title, tags, starred, archive, content, language, published_at, authors,
public, original_url)
return data
def test_get_entries(self):