vendredi 3 avril 2015

Accessing API using Flask


Vote count:

0




I'm using Python Flask Framework to access IdeOne's API . API documentation here : http://ift.tt/1DvTQOH


I'm am getting the following error even after refactoring the code multiple times .



Internal Server Error

The server encountered an internal error and was unable to complete your request. Either the server is overloaded or there is an error in the application.


Code :



from flask import Flask
from SOAPpy import WSDL

app = Flask(__name__)

@app.route('/')
def calling():
user = 'xxx'
passw = 'xxx'
lang = 1
code = """#include<stdio.h>
int main() {
printf("hello");
return 0;
}"""
iinput = ''
run = true
private = false
client = WSDL.Proxy('http://ift.tt/1iChN5M')
result = client.createSubmission( user, passw, code, lang, iinput, run, private )
if(result['error'] == 'OK'):
status = client.getSubmissionStatus(user, passw, result['link'])
if(status['error'] == 'OK'):
while(status['status'] != 0):
sleep(3)
status = client.getSubmissionStatus(user,passw,result['link'])
details = client.getSubmissionDetails(user,passw,result['link'],true,true,true,true,true)
if(details['error'] == 'OK'):
return details
else:
return details
else:
return status
else:
return result

if __name__ == '__main__':
app.run()


I'd be glad if anyone could help me figure out the mistake .Please have a look at documentation regarding calls.



asked 38 secs ago

saru95

374






Accessing API using Flask

Aucun commentaire:

Enregistrer un commentaire