def connect_to_objectstore(config): """Connect to the objectstore The Amsterdam/objectstore library is used to connect to the objectstore :return: a connection to the given objectstore """ # Get the objectstore config based on the source application name try: user = f"({config['USER']}@{config['TENANT_NAME']})" connection = get_connection(config) except KeyError as e: raise GOBException( f'Missing configuration for source {config["name"]}. Error: {e}') except Exception as e: raise GOBException( f"Objectstore connection for source {config['name']} {user} failed. Error: {e}." ) else: return connection, user
def get_connection(self): if not self.connection: self.connection = objectstore.get_connection(self.config) return self.connection
def get_connection(self): connection = objectstore.get_connection(self.config) return connection
def get_os_file_stream(self, meta): file_name = meta['name'] connection = objectstore.get_connection(settings.OBJECTSTORE_CONF) _object = connection.get_object("blip_wifi", file_name) return io.BytesIO(_object[1])
def get_os_meta_list(self): connection = objectstore.get_connection(settings.OBJECTSTORE_CONF) return objectstore.get_full_container_list(connection, 'blip_wifi')
def get_objectstore_connection(): assert os.getenv('BOUWDOSSIERS_OBJECTSTORE_PASSWORD') connection = objectstore.get_connection(settings.OBJECTSTORE) return connection