Moved haste() to util/web

This commit is contained in:
Luke Rogers 2012-09-02 23:48:47 +12:00
parent 23dde386d0
commit c44b1dcd6a
2 changed files with 11 additions and 10 deletions

View file

@ -1,14 +1,7 @@
import http
import http, web
import json, urllib2, sys
def haste(data):
URL = "http://paste.dmptr.com"
request = urllib2.Request(URL + "/documents", data)
response = urllib2.urlopen(request)
return("%s/%s" % (URL, json.loads(response.read())['key']))
def eval_py(code, paste_multiline=True):
while True:
output = http.get("http://eval.appspot.com/eval", statement=code).rstrip('\n')
@ -23,6 +16,6 @@ def eval_py(code, paste_multiline=True):
status = "Code executed sucessfully: "
if "\n" in output and paste_multiline:
return status + haste(output)
return status + web.haste(output)
else:
return output