No description or website provided.
Python CSS JavaScript
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.
LICENSE.txt Fixed bug with delete_paste Jan 11, 2013



The package allows you to communicate directly with from your Python application, either logged in or anonymously. This can be handy

for a number of reasons - dumping error logs before an abort, regular web based status updates, but can't be bothered getting a web-server running etc.

It allows you to do everything the API allows, which is:

  • Paste, either logged in or anonymously
  • 200+ selectable languages for syntax highlighting
  • Set expiry times on pastes
  • Set public/private/unlisted status for pastes
  • See trending pastes
  • See pastes by a particular user
  • Delete your pastes
  • Retrieve your user details
  • Generate a session (user) key for added security
  • Paste using the old, non-token anonymous API (for as long as they keep it open)


If you have downloaded the source distribution, to install do the following at the commandline:

$ python install

If you can use and install Python Egg's, you can do:

$ easy_install Pastebin

And it will download the latest version from the Python Package Index.

Usage Examples

Generate a user/session key (this is required by other functions):

from pastebin import PastebinAPI
my_key = PastebinAPI.generate_user_key(api_dev_key, username, password)
print my_key

Return an XML list of User Details of user specified by API key.

details = PastebinAPI.user_details(api_dev_key, api_user_key)
print details

Return a list of trending pastes. The result is in XML:

trending_pastes = PastebinAPI.trending(api_dev_key)
print trending_pastes

Return an XML list of all pastes by user. Result limit defaults to none, so it will return all pastes:

details = x.user_details(api_dev_key, api_user_key, results_limit = None)

Delete a paste:

PastebinAPI.delete_paste(api_dev_key, api_user_key, api_paste_key)

Paste to Pastebin, where api_paste_code is the contents of your paste. This will accept any valid Python data type:

PastebinAPI.paste(api_dev_key, api_paste_code, api_user_key = None, 
                   paste_name = None, paste_format = None, 
                   paste_private = None, paste_expire_date = None)

Note that any parameter which is listed about as ' = None' is optional. Details of valid input parameters for paste function are below.

Valid paste_private values:

  • 'public'
  • 'unlisted'
  • 'private'

Valid paste_expire_date values:

'10M'10 minutes
'1H'1 hour
'1D'1 day
'1M'1 month

Valid parse_format values:

Input Language
'6502acme'6502 ACME Cross Assembler
'6502kickass'6502 Kick Assembler
'6502tasm'6502 TASM/64TASS
'actionscript3'ActionScript 3
'algol68'ALGOL 68
'apache'Apache Log
'apt_sources'APT Sources
'asm'ASM (NASM)
'bascomavr'BASCOM AVR
'blitzbasic'Blitz Basic
'c_mac'C for Macs
'cil'C Intermediate Language
'cpp-qt'C++ (with QT extensions)
'c_loadrunner'C: Loadrunner
'caddcl'CAD DCL
'cadlisp'CAD Lisp
'klonec'Clone C
'klonecpp'Clone C++
'oxygene'Delphi Prism (Oxygene)
'fo'FO Language
'f1'Formula One
'gml'Game Maker
'hq9plus'HQ9 Plus
'html5'HTML 5
'ini'INI file
'inno'Inno Script
'java5'Java 5
'lb'Liberty BASIC
'lsl2'Linden Scripting
'locobasic'Loco Basic
'lolcode'LOL Code
'lotusformulas'Lotus Formulas
'lotusscript'Lotus Script
'm68k'M68000 Assembler
'mmix'MIX Assembler
'modula2'Modula 2
'modula3'Modula 3
'68000devpac'Motorola 68000 HiSoft Dev
'nsis'NullSoft Installer
'oberon2'Oberon 2
'objeck'Objeck Programming Language
'objc'Objective C
'ocaml-brief'OCalm Brief
'glsl'OpenGL Shading
'oobas'Openoffice BASIC
'oracle11'Oracle 11
'oracle8'Oracle 8
'perl6'Perl 6
'php-brief'PHP Brief
'pic16'Pic 16
'pixelbender'Pixel Bender
'powershell'Power Shell
'rpmspec'RPM Spec
'gnuplot'Ruby Gnuplot
'teraterm'Tera Term
'visualprolog'Visual Pro Log
'xorg_conf'Xorg Config
'z80'Z80 Assembler