def update_files(self, fileName): try: filePath = os.path.abspath( os.path.join(os.path.dirname(__file__), self.dirPath)) + '/' + fileName f = open(filePath, 'r') text = f.read() f.close() name = self.folderName + '/' + fileName append_blob_service = AppendBlobService( account_name='navview', account_key= '+roYuNmQbtLvq2Tn227ELmb6s1hzavh0qVQwhLORkUpM0DN7gxFc4j+DF/rEla1EsTN2goHEA1J92moOM/lfxg==', protocol='http') append_blob_service.create_blob( container_name='data', blob_name=name, content_settings=ContentSettings(content_type='text/plain')) append_blob_service.append_blob_from_bytes( container_name='data', blob_name=name, blob=text, progress_callback=self.processCall) except Exception as e: print(e)
def output_stats_to_json_blob(feed_stats_dict): append_blob_service = AppendBlobService(STORAGE_ACCT_NAME, BLOB_KEY) json_string = '"' + feed_stats_dict['FeedName'] + '":' + json.dumps( feed_stats_dict) + ',' if LOGGING: print("Writing to blob: {}".format(json_string)) append_blob_service.append_blob_from_bytes(BLOB_CONTAINER, STATS_FILE_NAME, json_string.encode())
def open_stats_blob_json(): append_blob_service = AppendBlobService(STORAGE_ACCT_NAME, BLOB_KEY) file_contents = "{" + "\"ProcessDate\": \"{}\",".format(current_date) #file_contents = "{" try: append_blob_service.create_blob(BLOB_CONTAINER, STATS_FILE_NAME, if_none_match='*') except: print("Tried to Create Existing Blob") append_blob_service.append_blob_from_bytes(BLOB_CONTAINER, STATS_FILE_NAME, file_contents.encode())
def close_stats_blob_json(): append_blob_service = AppendBlobService(STORAGE_ACCT_NAME, BLOB_KEY) append_blob_service.append_blob_from_bytes(BLOB_CONTAINER, STATS_FILE_NAME, "}".encode())