I hate this Python API

This commit is contained in:
Luke Rogers 2012-09-05 22:35:46 +12:00
parent 61752baa24
commit dd8e369ce5

View file

@ -7,6 +7,10 @@ def eval_py(code, paste_multiline=True):
while True: while True:
try: try:
output = http.get("http://eval.appspot.com/eval", statement=code).rstrip('\n') output = http.get("http://eval.appspot.com/eval", statement=code).rstrip('\n')
# sometimes the API returns a blank string on first attempt, lets try again
# and make sure it is actually supposed to be a blank string. ._.
if output == "":
output = http.get("http://eval.appspot.com/eval", statement=code).rstrip('\n')
break break
except http.HTTPError: except http.HTTPError:
if attempts > 2: if attempts > 2: