ibridges.session.Session

class ibridges.session.Session(irods_env, password=None, irods_home=None, cwd=None)

Session to connect and perform operations on the iRODS server.

When the session is initialized, you are connected succesfully to the iRODS server. Most likely you will need to supply a password to the initialization routine. This can be problematic from a security standpoint (the password might be recorded for others to see). In this case, you should use the ibridges.interactive.interactive_auth() function, which will ask for your password and not store it.

The Session object is a context manager, so using it using the with statement is generally preferred, see examples below. Otherwise, the user is responsible for closing the connection using the close() method.

Parameters:
  • irods_env (Union[dict, str, Path]) – iRODS environment (irods_environment.json) file, or a dictionary containing its contents.

  • password (Optional[str]) – Pass the password as a string. By default None, in which case it will try to use the cached password. If this fails, the initialization will fail and throw an exception.

  • irods_home (Optional[str]) – Override the home directory of irods. Otherwise attempt to retrive the value from the irods environment dictionary. If it is not there either, then use /{zone}/home/{username}.

Raises:
  • FileNotFoundError: – If the irods_env parameter is interpreted as a file name and not found.

  • TypeError: – If the irods_env parameter is not a dict, str or Path.

  • LoginError: – If the connection to the iRODS server fails to establish.

Examples

>>> session = Session(Path.home() / ".irods" / "irods_environment.json",
>>>                    password="your_password", irods_home="/zone/home/user")
>>> session = Session(env_dictionary)  # env_dictionary with connection info
>>> with Session("irods_environment.json") as session:
>>>     # Do operations with the session here.
>>>     # The session will be automatically closed on finish/error.
__init__(irods_env, password=None, irods_home=None, cwd=None)

Authenticate and connect to the iRODS server.

Methods

__init__(irods_env[, password, irods_home, cwd])

Authenticate and connect to the iRODS server.

authenticate_using_auth_file()

Authenticate with an authentication file.

authenticate_using_password()

Authenticate with the iRODS server using a password.

close()

Disconnect the iRODS session.

connect()

Establish an iRODS session.

get_user_info()

Query for user type and groups.

has_valid_irods_session()

Check if the iRODS session is valid.

network_check(hostname, port)

Check connectivity to an iRODS server.

write_pam_password()

Store the password in the iRODS authentication file in obfuscated form.

Attributes

cwd

Current working directory for irods.

default_resc

Default resource name from iRODS environment.

home

Home directory for irods.

server_version

Retrieve version of the iRODS server.