pyheap is a Python implementation of the RefHeap API. It was originally created as a Python learning project for myself, but still continues to be tweaked and improved.
You can obtain the pyheap source through GitHub:
git clone git://github.com/aburdette/pyheap.git
Add the pyheap folder to your project and import
from pyheap import refheap
From there, you can instantiate a
Paste object, optionally passing in username and api-token (Note: username and token are required for some API calls):
p = refheap.Paste('username', 'token')
API calls are made through this new
Paste object. A tuple containing the web service response and the content is returned. Here is some copy/paste from IDLE showing some basic usage:
>>> p = Paste('username', 'api-token') >>> resp = p.get(1) >>> print(resp['status']) 200 >>> print(resp['contents']) (begin) >>> resp = p.create('This is a new private paste.', True) >>> print(resp['status']) 201 >>> print(resp['private']) True >>> print(resp['contents']) This is a new private paste. >>> resp = p.delete(resp['paste-id']) >>> print(resp['status']) 204
Copyright © 2012 Andre Burdette
Distributed under the Eclipse Public License, same as RefHeap.