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
withstatement is generally preferred, see examples below. Otherwise, the user is responsible for closing the connection using theclose()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 with an authentication file.
Authenticate with the iRODS server using a password.
close()Disconnect the iRODS session.
connect()Establish an iRODS session.
Query for user type and groups.
Check if the iRODS session is valid.
network_check(hostname, port)Check connectivity to an iRODS server.
Store the password in the iRODS authentication file in obfuscated form.
Attributes
Current working directory for irods.
Default resource name from iRODS environment.
Home directory for irods.
Retrieve version of the iRODS server.