Batch adding data to Pocket

For some reason I do not understand, Pocket seems to have no support for batch adding articles to the reading list. After looking around quite a bit it doesn’t even seem possible to get a simple add url so you can add them with a little batch script…

Since I still wanted to have my articles added I have written a little script to do so. It requires the Pocket library (pip install pocket) and works out of the box beyond that.

Save as and make sure you replace the consumer_key in the code. You can get the key from
[python]#!/usr/bin/env python

import sys
from pocket import Pocket

consumer_key = ‘18520-5994fa9c319241166deaf6b4′

request_token = Pocket.get_request_token(

auth_url = Pocket.get_auth_url(
print(‘Please authorize the app using the following url and press ENTER here’)

access_token = Pocket.get_access_token(
print(‘Got authenticated request token’)

def add_url(url):
print(‘adding’, url)

pocket_instance = Pocket(consumer_key, access_token)
for arg in sys.argv[1:]:
if arg.startswith(‘http’):
print(‘Reading urls from %r’ % arg)
for line in open(arg):

Usage is quite simple:

Or if you have a list of urls:
[bash]python urls.txt[/bash]

If people are interested I can make it into a web-app, but for the time being it solved my issue 🙂

Bookmark and Share


About Rick van Hattem

Rick van Hattem is a Dutch Internet entrepreneur and co-founder of

10 Responses to “Batch adding data to Pocket”

  1. Michael | 2013-11-01 at 14:28:29 #

    I can’t believe they don’t have this available somewhere in the interface…

  2. Paul | 2013-12-23 at 04:17:00 #

    Hi there,

    I tried your code, but got some error message that I don’t really understand. Can you help please? Thanks.

    Here is the error message from the terminal.

    Traceback (most recent call last):
    File “”, line 23, in
    File “/Library/Python/2.7/site-packages/”, line 326, in get_access_token
    return cls._make_request(url, payload, headers)[0][‘access_token’]
    File “/Library/Python/2.7/site-packages/”, line 141, in _make_request
    ‘%s. %s’ % (error_msg, extra_info)
    pocket.RateLimitException: User was authenticated, but access denied due to lack of permission or rate limiting. User rejected code.

    • Anirudh | 2014-12-11 at 16:09:06 #

      Hey Paul. I think you haven’t created a consumer key and a request token. The code doesn’t work directly. You’re supposed to add your credentials, if you haven’t already.

    • Ethan | 2014-12-22 at 19:33:06 #

      Did you ever get this sorted out, Paul?

  3. wolph | 2013-12-31 at 03:40:12 #

    @Paul: as the error states, you are being rate limited. Ido not know what the limits are but I assumed there would be some. Just try again after a few hours.

  4. Chris Combs | 2014-03-03 at 19:37:04 #

    Hey, thanks!

    To any other python noobs out there, don’t try to save this as “”… oops. That makes it try to import itself.

  5. Ethan | 2014-12-22 at 19:31:51 #

    I’m having the same error as Paul with this code, but the rate limit business makes zero sense to me, as I have added nothing with the script yet!

    • Rick van Hattem | 2015-01-28 at 19:37:49 #

      Hi Ethan, I’ve just tried to create a new application through the developer apps site and added the consumer-key in the code and it works like a charm for me.

      Perhaps the difference is in the checkboxes when creating the app. When creating the app ( I checked the following:
      Permissions: add
      Platforms: Desktop (other)

      Let me know if you have more problems, you can also mail me at wolph[at]

  6. Zuzana | 2019-09-25 at 18:17:42 #

    Hi, I used your code to create my own version of adding new links to my pocket, which I intend to run automatically on a weekly basis. But I wonder – is there a way how to authorize my app automatically without manual confirmation?

    • Rick van Hattem | 2019-09-25 at 18:54:23 #

      If you store the request_token instead of requesting it every time you can skip the authentication

Leave a Reply