Git Product home page Git Product logo

pocketapi's Introduction

Pocket API

Pocket API for Python 3

##Usage: At first, you will need a consumer key. Get your own at http://getpocket.com/developer/apps/new

Simple get method

p_cli = Pocket()
p_cli.login()
result = p_cli.get(
    {
        "state": "unread",
        "count": 10
    }
)

for id, entry in result["list"].items():
    print(entry["resolved_title"])

But! You can make your own callable function

p_cli.register_query(
    "get_two_archived",
    "get",
    {
        "state": "archive",
        "count": 2
    }
)
# now you can call it
p_cli.get_two_archived()

For more references and information about queries visit http://getpocket.com/developer/docs/overview

##Authentication:

OAuth 2.0, whole process is shown in login() function. Basically, user should be requested by an application to grant permissions in two steps.

request = p_cli.get_request()
# open browser, let user grant access
access_user_code = p_cli.get_access(request)
a_token = access_user_code["access_token"]
username = access_user_code["username"]

Access token is necessary to work with API. Access token and username can be passed as argument, request_uri too. Default request_uri is http://getpocket.com.

request_uri = http://yourapplicationwebsite.com
config = {
    "access_token": xxxxxxxx,
    "username": xxxxxxxx
}
p_cli = Pocket(config, request_uri)

pocketapi's People

Contributors

tcpj avatar

Watchers

 avatar  avatar

pocketapi's Issues

Pocket Article View API

I hope to get access to Pocket Article View API. After that i will implement it as well into my API.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.