Compare commits
3 Commits
wallabag_a
...
wallabag_a
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
9e5fdb1c50 | ||
|
|
e892d3ceeb | ||
|
|
e52b8befe4 |
@@ -16,7 +16,7 @@ to get the project, from your virtualenv, do :
|
|||||||
|
|
||||||
.. code:: python
|
.. code:: python
|
||||||
|
|
||||||
git clone https://github.com/foxmask/wallabag-api/
|
git clone https://github.com/push-things/wallabag-api/
|
||||||
|
|
||||||
|
|
||||||
or
|
or
|
||||||
@@ -57,7 +57,7 @@ Creating a post :
|
|||||||
|
|
||||||
this will give you something like this :
|
this will give you something like this :
|
||||||
|
|
||||||
.. image:: https://github.com/foxmask/wallabag_api/blob/master/wallabag.png
|
.. image:: https://github.com/push-things/wallabag_api/blob/master/wallabag.png
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -70,7 +70,7 @@ Then create a client API like explain here http://doc.wallabag.org/en/v2/develop
|
|||||||
|
|
||||||
this will give you somthing like this
|
this will give you somthing like this
|
||||||
|
|
||||||
.. image:: https://github.com/foxmask/wallabag_api/blob/master/wallabag_api_key.png
|
.. image:: https://github.com/push-things/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
|
||||||
|
|
||||||
|
|||||||
12
setup.py
12
setup.py
@@ -2,18 +2,19 @@ from setuptools import setup, find_packages
|
|||||||
from wallabag_api import __version__ as version
|
from wallabag_api import __version__ as version
|
||||||
|
|
||||||
install_requires = [
|
install_requires = [
|
||||||
'requests==2.18.4',
|
'requests',
|
||||||
]
|
]
|
||||||
|
|
||||||
setup(
|
setup(
|
||||||
name='wallabag_api',
|
name='wallabag_api',
|
||||||
version=version,
|
version=version,
|
||||||
description='Wallabag API to add every pages you want to your Wallabag account',
|
description='Wallabag API to add every pages you want to your Wallabag account',
|
||||||
|
long_desc='Wallabag is a "read it later" service, and that Wallabag API allow you to save web pages '
|
||||||
|
'to your own account',
|
||||||
author='FoxMaSk',
|
author='FoxMaSk',
|
||||||
author_email='foxmask@trigger-happy.eu',
|
author_email='foxmaskhome@gmail.com',
|
||||||
url='https://github.com/foxmask/wallabag_api',
|
url='https://github.com/push-things/wallabag_api',
|
||||||
download_url="https://github.com/foxmask/wallabag_api/archive/"
|
download_url="https://github.com/push-things/wallabag_api/archive/wallabag_api-" + version + ".zip",
|
||||||
"wallabag_api-" + version + ".zip",
|
|
||||||
packages=find_packages(),
|
packages=find_packages(),
|
||||||
classifiers=[
|
classifiers=[
|
||||||
'Development Status :: 4 - Beta',
|
'Development Status :: 4 - Beta',
|
||||||
@@ -23,6 +24,7 @@ setup(
|
|||||||
'Programming Language :: Python',
|
'Programming Language :: Python',
|
||||||
'Programming Language :: Python :: 3.4',
|
'Programming Language :: Python :: 3.4',
|
||||||
'Programming Language :: Python :: 3.5',
|
'Programming Language :: Python :: 3.5',
|
||||||
|
'Programming Language :: Python :: 3.6',
|
||||||
'Topic :: Internet',
|
'Topic :: Internet',
|
||||||
'Topic :: Communications',
|
'Topic :: Communications',
|
||||||
],
|
],
|
||||||
|
|||||||
@@ -1,2 +1,2 @@
|
|||||||
VERSION = (1, 1, 2) # PEP 386
|
VERSION = (1, 1, 4) # PEP 386
|
||||||
__version__ = ".".join([str(x) for x in VERSION])
|
__version__ = ".".join([str(x) for x in VERSION])
|
||||||
|
|||||||
@@ -157,7 +157,8 @@ class Wallabag(object):
|
|||||||
|
|
||||||
return self.query(path, "get", **params)
|
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}
|
POST /api/entries.{_format}
|
||||||
|
|
||||||
@@ -168,10 +169,18 @@ class Wallabag(object):
|
|||||||
:param tags: tag1,tag2,tag3 a comma-separated list of tags.
|
:param tags: tag1,tag2,tag3 a comma-separated list of tags.
|
||||||
:param starred entry already starred
|
:param starred entry already starred
|
||||||
:param archive entry already archived
|
:param archive entry already archived
|
||||||
|
:param content additionnal html content
|
||||||
|
:param language
|
||||||
|
:param published_at
|
||||||
|
:param authors
|
||||||
|
:param public
|
||||||
|
:param original_url
|
||||||
:return result
|
:return result
|
||||||
"""
|
"""
|
||||||
params = {'access_token': self.token, 'url': url, 'title': title,
|
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):
|
if len(tags) > 0 and isinstance(tags, list):
|
||||||
params['tags'] = ', '.join(tags)
|
params['tags'] = ', '.join(tags)
|
||||||
path = '/api/entries.{ext}'.format(ext=self.format)
|
path = '/api/entries.{ext}'.format(ext=self.format)
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
# coding: utf-8
|
# coding: utf-8
|
||||||
|
import datetime
|
||||||
import unittest
|
import unittest
|
||||||
from wallabag import Wallabag
|
from wallabag import Wallabag
|
||||||
|
|
||||||
@@ -31,11 +32,18 @@ class TestWallabag(unittest.TestCase):
|
|||||||
|
|
||||||
def create_entry(self):
|
def create_entry(self):
|
||||||
title = 'foobar title'
|
title = 'foobar title'
|
||||||
url = 'https://trigger-happy.eu/'
|
url = 'https://somwhere.over.the.raibow.com/'
|
||||||
tags = ['foo', 'bar']
|
tags = ['foo', 'bar']
|
||||||
starred = 0
|
starred = 0
|
||||||
archive = 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
|
return data
|
||||||
|
|
||||||
def test_get_entries(self):
|
def test_get_entries(self):
|
||||||
|
|||||||
Reference in New Issue
Block a user