All pastes #21754 Raw Edit

gjc

public text v1 · immutable
#21754 ·published 2005-08-31 18:00 UTC
rendered paste body
--- pastebin.orig	2005-08-31 18:59:51.000000000 +0100+++ pastebin	2005-08-31 19:00:22.000000000 +0100@@ -19,7 +19,7 @@ # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA. # -import getopt, sys, urllib, re, pwd, os+import getopt, sys, urllib, urllib2, re, pwd, os try: 	import pygtk 	pygtk.require("2.0")@@ -36,9 +36,6 @@ try: except ImportError: 	WITH_GNOMEVFS = False 		-from twisted.internet import reactor-from twisted.web import client- # General Constants TYPES = [ "raw", "asterisk", "c", "cpp", "php", "perl", "java", "vb", "csharp",@@ -80,14 +77,14 @@ def paste(content, description="", name= 		"expiry" : urllib.quote_plus(expiry), 		"name" : urllib.quote_plus(name) 		}-	-	return client.getPage(URL, postdata=payload, method="POST", headers={+	req = urllib2.Request(URL, payload, { 		"Referer": "http://en.pastebin.ca/", 		"Content-Type": "application/x-www-form-urlencoded", 		"User-Agent": "Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.7.10) Gecko/20050813 Epiphany/1.7.6", 		"Accept-Language": "en", 		"Accept-Charset": "utf-8", 		})+	return urllib2.urlopen(req).read()  def got_error(err): 	sys.stderr.write("%r\n" % err)@@ -237,6 +234,6 @@ if __name__ == "__main__": 	elif not type in TYPES: 		sys.stderr.write('Unknown type: %s\n' % type) 		sys.exit()-	-	paste(content, description, name, expiry, type).addCallbacks(got_page, got_error).addBoth(lambda x: reactor.stop())-	reactor.run()++	res = paste(content, description, name, expiry, type)+	got_page(res)