未提供项目描述
项目描述
irods_fsspec
允许您使用irods://
URL从iRODS服务器打开文件。
使用方法
隐式身份验证
如果您已经安装了iRODS iCommands,请使用iinit
登录以存储您的用户名和密码。后续使用irods_fsspec将自动使用这些凭据。(您也可以在shell中设置$IRODS_ENVIRONMENT_FILE
,使其指向irods_environment.json
。)
import fsspec
import irods_fsspec
irods_fsspec.register() # register irods:// handler
# Write to iRODS path
f1 = fsspec.open('irods://data.cyverse.org/iplant/home/myuser/test.txt', 'wb')
with f1 as fh:
fh.write(b'test\n')
# Read from iRODS path
f2 = fsspec.open('irods://data.cyverse.org/iplant/home/myuser/test.txt', 'rb')
with f2 as fh:
assert fh.read() == b'test\n'
显式身份验证
用户、区域、密码和端口都可以包含在URL中,从而绕过对iinit
/ iCommands的需求
f3 = fsspec.open('irods://myuser+iplant:mypass@data.cyverse.org:1247/iplant/home/myuser/test.txt', 'rb')
with f3 as fh:
assert fh.read() == b'test\n'
格式如下所示
irods://<username>+<zone>:<password>@<hostname>[:<port>]/<path to data object>
注意+
用于分隔用户名和区域名称。如果省略了:<port>
,irods_fsspec将使用默认端口,但所有其他组件都是必需的。
文件系统API使用
要使用IRODSFileSystem
API,可以自行导入或使用fsspec
irodsfs = fsspec.filesystem('irods', user='myuser', zone='iplant', password='mypass', host='data.cyverse.org', port=1247)
irodsfs.mkdir('/iplant/home/myuser/_irods_fsspec_test/')
irodsfs.mv('/iplant/home/myuser/test.txt', '/iplant/home/myuser/_irods_fsspec_test/test2.txt')
f4 = irodsfs.open('/iplant/home/myuser/_irods_fsspec_test/test2.txt', 'rb')
with f4 as fh:
assert fh.read() == b'test\n'
项目详情
下载文件
为您的平台下载文件。如果您不确定要选择哪个,请了解更多关于安装包的信息。
源分布
irods_fsspec-0.0.1.tar.gz (19.8 kB 查看哈希)
构建分布
irods_fsspec-0.0.1-py3-none-any.whl (18.6 kB 查看哈希)