def upload_to_s3_bucket(self, file_path): self.total = os.stat(file_path).st_size print("Uploading to s3 bucket....") s3 = self.session.resource('s3') try: self.update_status("started_at", datetime.datetime.now()) s3.meta.client.upload_file( file_path, self.bucket, self.filename, Callback=self.upload_progress) self.update_status("status", "Done") self.update_status("done_at", datetime.datetime.now()) print("Uploading to s3 bucket done") except ClientError as e: logging.error(e) self.update_status("Failed") self.delete_downloaded_file(file_path)