Exemple #1
0
    def spock_update():
        if os.path.exists(path_from_top_directory(CONFIG_PATH)) is False:
            os.makedirs(path_from_top_directory(CONFIG_PATH))

        SpockRetrieve.initialize()
        SpockRetrieve.download_map()
        SpockMap.open(path_from_top_directory(MAP_PATH))
    def download(self, file_name):
        if os.path.exists(os.path.join(path_from_top_directory(self.download_dir), file_name)):
            return True, os.path.join(path_from_top_directory(self.download_dir), file_name)

        exists, obj = self.search_file(file_name)

        if exists:
            _download_file = os.path.join(path_from_top_directory(self.download_dir), file_name)
            self.s3_resource.Bucket(obj.bucket_name).download_file(obj.key, _download_file)
            return True, _download_file

        return False, ""
Exemple #3
0
 def _download_map(self):
     should_download, map_object = self._should_i_download_map()
     try:
         if should_download:
             _bucket = map_object.bucket_name
             self.s3_resource.Bucket(_bucket).download_file(
                 map_object.key, path_from_top_directory(MAP_PATH))
             print("Downloaded map from bucket " + _bucket)
     except ClientError:
         print("Unable to download map")
    def get_file_from_downloads(self, file_name):
        _path = os.path.join(path_from_top_directory(self.download_dir), file_name)
        if os.path.exists(_path):
            return True, _path

        return False, ""
 def _build_dir(self):
     if self.download_dir is not None:
         if os.path.exists(path_from_top_directory(self.download_dir)) is False:
             os.makedirs(path_from_top_directory(self.download_dir))