Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import httplib, urllib, sys
- def post_paste(body, dev_key = 'log in to pastebin and go to http://pastebin.com/api#1 to get your dev key', title = '', private = 1, user_key = ''):
- params = urllib.urlencode({'api_option' : 'paste', 'api_dev_key': dev_key, 'api_paste_private' : private, 'api_paste_name': title, 'api_paste_code' : body})
- headers = {"Content-type": "application/x-www-form-urlencoded", "Accept": "text/plain"}
- conn = httplib.HTTPConnection("www.pastebin.com")
- conn.request("POST", "/api/api_post.php", params, headers)
- response = conn.getresponse()
- data = response.read()
- print data
- conn.close()
- paste_body = sys.stdin.read()
- if(paste_body == ""):
- quit()
- post_paste(paste_body)
- #fractals_
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement