Compare commits
8 Commits
wallabag_a
...
1.2.2
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
825efab0f7 | ||
|
|
2c269fba43 | ||
|
|
07d3840ca6 | ||
|
|
43b1602cbb | ||
|
|
c6f62a4697 | ||
|
|
63cd4e80cb | ||
|
|
b7d4abb0d1 | ||
|
|
5b3cd028a7 |
@@ -27,7 +27,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
|
||||||
@@ -110,7 +110,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
|
||||||
|
|
||||||
|
|
||||||
Testing :
|
Testing :
|
||||||
@@ -124,7 +124,7 @@ Then create a client API like explain here http://doc.wallabag.org/en/v2/develop
|
|||||||
|
|
||||||
this will give you something like this
|
this will give you something 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
|
||||||
|
|
||||||
|
|||||||
10
setup.py
10
setup.py
@@ -2,19 +2,21 @@ from setuptools import setup, find_packages
|
|||||||
from wallabag_api import __version__ as version
|
from wallabag_api import __version__ as version
|
||||||
|
|
||||||
desc = 'Wallabag API to add every pages you want to your Wallabag account'
|
desc = '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'
|
||||||
install_requires = [
|
install_requires = [
|
||||||
'aiohttp==2.2.5',
|
'aiohttp',
|
||||||
]
|
]
|
||||||
|
|
||||||
setup(
|
setup(
|
||||||
name='wallabag_api',
|
name='wallabag_api',
|
||||||
version=version,
|
version=version,
|
||||||
description=desc,
|
description=desc,
|
||||||
|
long_description=long_desc,
|
||||||
author='FoxMaSk',
|
author='FoxMaSk',
|
||||||
author_email='foxmask@trigger-happy.eu',
|
author_email='foxmask@trigger-happy.eu',
|
||||||
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 :: 5 - Production/Stable',
|
'Development Status :: 5 - Production/Stable',
|
||||||
|
|||||||
@@ -1,2 +1,2 @@
|
|||||||
VERSION = (1, 2, 0) # PEP 386
|
VERSION = (1, 2, 2) # PEP 386
|
||||||
__version__ = ".".join([str(x) for x in VERSION])
|
__version__ = ".".join([str(x) for x in VERSION])
|
||||||
|
|||||||
@@ -33,8 +33,8 @@ class Wallabag(object):
|
|||||||
client_id='',
|
client_id='',
|
||||||
client_secret='',
|
client_secret='',
|
||||||
extension='json',
|
extension='json',
|
||||||
user_agent="WallabagPython/1.3 "
|
user_agent="WallabagPython/1.2.2 "
|
||||||
"+https://github.com/foxmask/wallabag-api",
|
" +https://github.com/push-things/wallabag-api",
|
||||||
aio_sess=None):
|
aio_sess=None):
|
||||||
"""
|
"""
|
||||||
init variable
|
init variable
|
||||||
@@ -97,18 +97,21 @@ class Wallabag(object):
|
|||||||
:param responses: the json response
|
:param responses: the json response
|
||||||
:return the json data without 'root' node
|
:return the json data without 'root' node
|
||||||
"""
|
"""
|
||||||
if responses.status != 200:
|
|
||||||
raise HttpProcessingError(code=responses.status,
|
|
||||||
message=await responses.json())
|
|
||||||
json_data = {}
|
json_data = {}
|
||||||
try:
|
if responses.status != 200:
|
||||||
json_data = responses.json()
|
err_msg = HttpProcessingError(code=responses.status,
|
||||||
except ClientResponseError as e:
|
message=await responses.json())
|
||||||
# sometimes json_data does not return any json() without
|
logging.error("Wallabag: aiohttp error {err_msg}".format(
|
||||||
# any error. This is due to the grabbing URL which "rejects"
|
err_msg=err_msg))
|
||||||
# the URL
|
else:
|
||||||
logging.error("Wallabag: aiohttp error {code} {message}"
|
try:
|
||||||
.format(code=e.code, message=e.message))
|
json_data = responses.json()
|
||||||
|
except ClientResponseError as e:
|
||||||
|
# sometimes json_data does not return any json() without
|
||||||
|
# any error. This is due to the grabbing URL which "rejects"
|
||||||
|
# the URL
|
||||||
|
logging.error("Wallabag: aiohttp error {code} {message}"
|
||||||
|
.format(code=e.code, message=e.message))
|
||||||
return await json_data
|
return await json_data
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
@@ -329,7 +332,8 @@ class Wallabag(object):
|
|||||||
|
|
||||||
:return result
|
:return result
|
||||||
"""
|
"""
|
||||||
params = {'url': url,
|
params = {'access_token': self.token,
|
||||||
|
'url': url,
|
||||||
'urls': urls}
|
'urls': urls}
|
||||||
|
|
||||||
path = '/api/entries/exists.{ext}'.format(ext=self.format)
|
path = '/api/entries/exists.{ext}'.format(ext=self.format)
|
||||||
|
|||||||
@@ -109,5 +109,6 @@ class TestWallabag(unittest.TestCase):
|
|||||||
self.assertTrue(resp, True)
|
self.assertTrue(resp, True)
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
unittest.main()
|
unittest.main()
|
||||||
|
|||||||
Reference in New Issue
Block a user