Пример #1
0
 def upload(self, url, user, token, file, filetype='default'):
     files = {}
     files["file"] = (os.path.basename(file), open(file, 'rb'))
     logger.debug("Message sent to shock on upload: %s" % files)
     sclient = shock.Shock(url, user, token)
     if filetype == 'contigs' or filetype == 'scaffolds':
         res = sclient.upload_contigs(file)
     else:
         res = sclient.upload_file(file, filetype, curl=True)
     return res
Пример #2
0
 def upload(self, url, user, token, file, filetype='default'):
     files = {}
     files["file"] = (os.path.basename(file), open(file, 'rb'))
     logging.debug("Message sent to shock on upload: %s" % files)
     sclient = shock.Shock(url, user, token)
     if filetype == 'default':
         res = sclient.upload_misc(file, 'default')
     elif filetype == 'contigs':
         res = sclient.upload_contigs(file)
     return res
Пример #3
0
 def download_shock(self, url, user, token, node_id, outdir):
     sclient = shock.Shock(url, user, token)
     downloaded = sclient.curl_download_file(node_id, outdir=outdir)
     return self.extract_file(downloaded)
Пример #4
0
 def upload_file(self, url, user, token, file, filetype='default'):
     files = {}
     files["file"] = (os.path.basename(file), open(file, 'rb'))
     sclient = shock.Shock(url, user, token)
     res = sclient.upload_file(file, filetype, curl=True)
     return res