måndag 5 april 2010

Writing to pastebin via python API

The parameters are listed here: http://pastebin.com/api.php

This example's pastes only live 10 minutes. Only the paste_code parameter is required.

text="""
print "Hello World!\\n"
"""
# send text to pastebin, use syntax highlighting
from urllib import urlopen, urlencode
url="http://pastebin.com/api_public.php"
args={"paste_code": text, 
    "paste_private":1, 
    "paste_expire_date":"10M",
    "paste_format":"python"}
print urlopen(url,urlencode(args)).read()

Inga kommentarer:

Skicka en kommentar