Method: Cnvrg::Files#download_and_read

Defined in:
lib/cnvrg/files.rb

#download_and_read(path) ⇒ Object



472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
# File 'lib/cnvrg/files.rb', line 472

def download_and_read(path)
  body = nil
  retries = 0
  success= false
  while !success and retries < 20
    begin
      if !Helpers.is_verify_ssl
        body = open(path, {ssl_verify_mode: OpenSSL::SSL::VERIFY_NONE}).read
      else
        body = open(path).read
      end
      success = true
    rescue => e
      retries +=1
      sleep(1)
    end
  end
  body
end