Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/gsora/pypocket
A tiny Python3 library for Pocket (ReadItLater)
https://github.com/gsora/pypocket
Last synced: about 17 hours ago
JSON representation
A tiny Python3 library for Pocket (ReadItLater)
- Host: GitHub
- URL: https://github.com/gsora/pypocket
- Owner: gsora
- Created: 2014-02-16T12:22:22.000Z (almost 11 years ago)
- Default Branch: master
- Last Pushed: 2014-06-27T23:06:28.000Z (over 10 years ago)
- Last Synced: 2023-08-14T03:50:58.172Z (over 1 year ago)
- Language: Python
- Size: 145 KB
- Stars: 1
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
pyPocket
========A **simple** Pocket (*ReadItLater*) module for Python3.
I wrote this basically for learning purposes, nothing too much professional.
What does this do
-----------------
By now, pyPocket succesfully handle the Pocket's custom **OAuth** authentication method, can get a JSON object containing various metadata of the authorized account's links and can post them too!```
from pyPocket import *requestToken(consumerKey, redirectUri) # retrieve the request token used for the auth token generation
accessToken(consumerKey, requestToken) # retrieve the auth token, useful to request and post data
getData(consumerKey, accessToken) # returns links data in JSON
addData(consumerKey, accessToken, URL) # add a link to Pocket
```
As you can see, this module is self-explaining.Exceptions thrown
-----------------
As from [this](https://github.com/peppelakappa/pyPocket/commit/a56c557ea9327916d8401a6041a8b342dcf03f32) commit, the module will throw these exceptions when error occurs:```
PocketCommError # occurs in some general case
ConsumerKeyError # occurs when Pocket returns an error related to the consumer key
AccessTokenError # occurs when Pocket returns an error related to the access token
AddDataError # occurs generally when you're trying to push a link to Pocket without authentication or with old auth data
````ConsumerKeyError` and `AccessTokenError` will throw a detailed description on why your function isn't working.
Alert!
------
I'm making changes almost everyday to function prototypes and names, using this library in a production environment is **strongly not adviced!**It's beta software, *handle with care*
The test file
-------------
I wrote a simple test script to let you understand how to use my module.
```
usage: test.py [-h] [--getLinks] [--add ADD]optional arguments:
-h, --help show this help message and exit
--getLinks get the list of the authorized account's saved links
--add ADD add a link to the authorized account
```
It works well and saves your auth token in **plain text**, into the file `myLoginData` under the current directory.License
=======The MIT License (MIT)
Copyright (c) 2014 PeppeLaKappa
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE
OR OTHER DEALINGS IN THE SOFTWARE.
Written by [PeppeLaKappa](http://twitter.com/PeppeLaKappa), gianguidorama [at] gmail [dawt] com