A simple Pastebin API wrapper written in Python 3.4
Code examples:
Create paste with no additional arguments:
from pb_api import PasteAPI pb = PasteAPI('devkey', 'userkey') # userkey optional pb.create_paste('Paste content')
Create paste with a title, formatted for python, Private, and expiring in 1 hour: (see pb_lists.py for valid arguments for format, privacy, and expire)
from pb_api import PasteAPI pb = PasteAPI('devkey', 'userkey') # userkey optional pb.create_paste('Paste content', title='Paste Title', format='python', privacy='2', expire='1H')
List pastes made by the user:
from pb_api import PasteAPI pb = PasteAPI('devkey', 'userkey') # userkey mandatory for list_user_pastes() pb.list_user_pastes(limit=10) # limit argument optional. defaults to 50
Requirements
The only requirement is the requests package
pip3 install requests