Example #1
0
 def exists(self, name):
     path = '/gs/%s' % self.bucket_name
     listdir = files.listdir(path, prefix= '/' + name)
     if len(listdir) == 1:
         return True
     else:
         return False
Example #2
0
def listing():
    filelist = files.listdir(BUCKET)
    flist = []
    for f in filelist:
        pref, fname = f.split(BUCKET+'/')
        flist.append(fname)
    return flist
Example #3
0
	def get(self):
		items=files.listdir('/gs/mybucket')
		if (len(items)==0):
			self._print("No filez!")
			my_file='/gs/mybucket/readme.txt'
			files.gs.create(my_file)
			f=files.open(my_file,'a')
			f.write('Hello world!')
			f.close()
		else:
			for i in items:
				self._print(i)
Example #4
0
 def testSuccessfulRun(self):
   p = cooperate.ExportCloudStoragePipeline("ExportCloudStoragePipeline",
         input_entity_kind="lakshmi.datum.FetchedDatum",
         gs_bucket_name=TEST_BUCKET_NAME,
         shards=3)
   p.start()
   test_support.execute_until_empty(self.taskqueue)
   cooperate.ExportCloudStoragePipeline.from_id(p.pipeline_id)
   
   file_list = files.listdir("/gs/"+TEST_BUCKET_NAME)
   self.assertTrue(len(file_list) > 0)
   for file_name in file_list:
     self.assertTrue(file_name.startswith("/gs/"))
Example #5
0
    def testSuccessfulRun(self):
        p = cooperate.ExportCloudStoragePipeline(
            "ExportCloudStoragePipeline",
            input_entity_kind="lakshmi.datum.FetchedDatum",
            gs_bucket_name=TEST_BUCKET_NAME,
            shards=3)
        p.start()
        test_support.execute_until_empty(self.taskqueue)
        cooperate.ExportCloudStoragePipeline.from_id(p.pipeline_id)

        file_list = files.listdir("/gs/" + TEST_BUCKET_NAME)
        self.assertTrue(len(file_list) > 0)
        for file_name in file_list:
            self.assertTrue(file_name.startswith("/gs/"))
Example #6
0
def list_events():
    path = "/gs/{bucket}".format(bucket=BUCKET_NAME)
    gs_files = files.listdir(path, max_keys=50)
    return render_template("list_events.html", files=gs_files)
Example #7
0
 def get(self, request, *args, **kwargs):
     content = {'page_title': "Admin :: Add Banner Managements",}
     file_list = files.listdir('/gs/swf_product_images')
     for file_name in file_list:
       if not file_name.__contains__('$folder$'):
         self.response.write('<a href="https://storage.cloud.google.com/%s">%s<a><br>' %(file_name[4:], file_name[4:]))