def submit(server_url, result):
 req = post((server_url + '/v1/benchmark-results'), json.dumps(result), headers={'Content-Type': ['application/json']})
 def get_response_content(response):
  d = json_content(response)
  d.addCallback((lambda content: (response, content)))
  return d
 req.addCallback(get_response_content)
 def process_response(response_and_content):
  (response, content) = response_and_content
  if (response.code != CREATED):
   raise SubmitFailure(response.code, response.phrase, content['message'])
  else:
   return content['id']
 req.addCallback(process_response)
 return req

def submit ( server_url , result ) : req = post ( ( server_url + '/v1/benchmark-results' ) , json . dumps ( result ) , headers = { 'Content-Type' : [ 'application/json' ] } ) def get_response_content ( response ) : d = json_content ( response ) d . addCallback ( ( lambda content : ( response , content ) ) ) return d req . addCallback ( get_response_content ) def process_response ( response_and_content ) : ( response , content ) = response_and_content if ( response . code != CREATED ) : raise SubmitFailure ( response . code , response . phrase , content [ 'message' ] ) else : return content [ 'id' ] req . addCallback ( process_response ) return req
sends an api post request and acts as a generic formatter for the json response .