Skip to main content
Help us improve Python packaging – donate today!

A Python wrapper for Pinboard.in

Project Description

Pinboard.py is an easy-to-use and fully-functional Python wrapper for the Pinboard.in API.

Installation

Pinboard.py is available for download through the Python Package Index (PyPi). You can install it right away using pip or easy_install.

pip install pinboard

Usage

To get started, you’re going to need to get your Pinboard API token from the password page on the Pinboard website. Once you’ve got that, you’re ready to go.

>>> import pinboard
>>> pb = pinboard.Pinboard(api_token)

Once you’ve done this, you can now use the pb object to make calls to the Pinboard API. Here are some examples:

# Retrieve all bookmarks
>>> pb.posts.all()

# Retrieve a single bookmark
>>> bookmark = pb.posts.all(results=1)[0]
<Bookmark title="Of Princesses and Dragons — Medium" url="medium.com">

>>> bookmark.time
datetime.datetime(2014, 7, 21, 11, 11, 59)

# Make a change to a bookmark and save it
>>> bookmark.title = "Of Princesses and Dragons"
>>> bookmark.tags = ["blogs", "interesting"]
>>> bookmark.save()
{u'result_code': u'done'}

# You can also save a bookmark without a bookmark object
>>> pb.posts.add(url="http://google.com/", description="A Great Search Engine", tags=["search", "tools"])
{u'result_code': u'done'}

# If you want to update the bookmark creation date as well, you'll need to pass in `update_time=True` to the save method
>>> import datetime
>>> bookmark.time = datetime.datetime.now() - datetime.timedelta(days=5)
>>> bookmark.save(update_time=True)

# Retrieve all tags
>>> pb.tags.get()

# By default, the Pinboard object will return parsed JSON objects. If you'd like the raw response object, just pass in `parse_response=False`
>>> response = pb.tags.get(parse_response=False)
>>> response
<addinfourl at 4396047680 whose fp = <socket._fileobject object at 0x105f79850>>
>>> response.read()
... your tags ...

Pinboard.py maps 1-1 to the Pinboard API (e.g., pb.one.two.three() will send a request to “https://api.pinboard.in/v1/one/two/three”). For more information on other methods and usage, please read the Pinboard API documentation.

License

Apache License, Version 2.0. See LICENSE for details.

Release history Release notifications

History Node

2.1.3

History Node

2.1.2

History Node

2.1.1

History Node

2.1.0

History Node

2.0.3

History Node

2.0.2

History Node

2.0.1

History Node

2.0.0

History Node

1.0.0

History Node

0.5.11

History Node

0.5.10

History Node

0.5.9

History Node

0.5.8

History Node

0.5.7

History Node

0.5.6

History Node

0.5.5

History Node

0.5.4

History Node

0.5.3

History Node

0.5.2

History Node

0.5.1

History Node

0.5

History Node

0.4.1

History Node

0.4

History Node

0.3.1

History Node

0.3

This version
History Node

0.2

History Node

0.1

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Filename, size & hash SHA256 hash help File type Python version Upload date
pinboard-0.2.tar.gz (4.1 kB) Copy SHA256 hash SHA256 Source None Jul 24, 2014

Supported by

Elastic Elastic Search Pingdom Pingdom Monitoring Google Google BigQuery Sentry Sentry Error logging CloudAMQP CloudAMQP RabbitMQ AWS AWS Cloud computing Fastly Fastly CDN DigiCert DigiCert EV certificate StatusPage StatusPage Status page