upload script

This is a simple Python script for uploading to It accepts file(s) or stdin, and uses the API for Pastebin v3 including user accounts etc. It can automatically set syntax highlighting based on file extension. It is designed for coders to easily and quickly share files, crash logs, etc.
This code is released into the public domain.
Comments, bugs, etc may be emailed to pastebin _at_ sentynel _dot_ com.


Basic usage is simply ./ file, or pipe into stdin with somecmd | ./ See ./ -h for details of options.
-i mode may be useful when piping in if you need to see the output (to get input prompts etc) of the program you're piping to pastebin. If you want to paste to a user account without having to supply your username and password each time, you can use ./ -k to retrieve your API key and add it to the definition at the top of the file. Subsequent pastes set to login will not require the username and password.
The autodetection of formatting can also be edited at the top of the file, either to add new filetypes or change the formatting (e.g. use cpp-qt for .cpp files, or non-Rails Ruby). Defaults are based on Pastebin's list of common formats.
The file can be moved or symlinked to a folder in your $PATH for easier invocation.
Note: Your pastes may still be caught by the spam filter if they include URLs. Visiting the returned URL will give you a captcha to complete in this case.
The script can be downloaded here.

Valid XHTML 1.0 Transitional