def _send_mfg_inspector_request(envelope_data, credentials, destination_url):
  """Send upload http request.  Intended to be run in retry loop."""
  logging.info('Uploading result...')
  http = httplib2.Http()

  if credentials.access_token_expired:
    credentials.refresh(http)
  credentials.authorize(http)

  resp, content = http.request(destination_url, 'POST', envelope_data)

  try:
    result = json.loads(content)
  except Exception:
    logging.debug('Upload failed with response %s: %s', resp, content)
    raise UploadFailedError(resp, content)

  if resp.status != 200:
    logging.debug('Upload failed: %s', result)
    raise UploadFailedError(result['error'], result)

  return result
def _send_mfg_inspector_request ( envelope_data , credentials , destination_url ) : logging . info ( 'Uploading result...' ) http = httplib2 . Http ( ) if credentials . access_token_expired : credentials . refresh ( http ) credentials . authorize ( http ) resp , content = http . request ( destination_url , 'POST' , envelope_data ) try : result = json . loads ( content ) except Exception : logging . debug ( 'Upload failed with response %s: %s' , resp , content ) raise UploadFailedError ( resp , content ) if resp . status != 200 : logging . debug ( 'Upload failed: %s' , result ) raise UploadFailedError ( result [ 'error' ] , result ) return result
Send upload http request.  Intended to be run in retry loop.