最小入侵网格(MIG)实用程序库

mig-utils的Python项目详细描述


https://travis-ci.org/rasmunk/mig_utils.svg?branch=master

最小入侵网格(MiG)实用程序python库: 它包括mig.io模块,该模块通过 为sshfs包装(https://github.com/althonos/fs.sshfs)的python sftp的连接和(https://github.com/ParallelSSH/ssh2-python.git) 这是默认和推荐的连接

安装

从pypi安装

pip install mig-utils

从本地git存储库安装

cd mig-utils
pip install .

IO示例

ERDA(https://erda.dk)共享链接访问python3示例。 对于IDMC(https://idmc.dk

也存在同样的Syrink类(IDMCStand)。
# First import the class that gives you access to the share in question*frommig.ioimportERDAShare,IDMCShare# ERDA Sharelink exampleprint("ERDA")# Open connection to a sharelinkerda_share=ERDAShare('SHARELINKID')# List files/dirs in shareprint(erda_share.list())witherda_share.open('tmp','w')astmp:tmp.write("sdfsfsf")# Get a _io.SFTPFileHandle object with automatic closewitherda_share.open('tmp','r')astmp:print(tmp.read())# Get a default _io.SFTPFileHandle object with manual lifetimefile=erda_share.open('tmp','r')print(file.read())file.close()# remove fileerda_share.remove('tmp')print("\n")# IDMC Sharelink exampleprint("IDMC")# Open connection to a sharelinkidmc_share=IDMCShare('SHARELINKID')# List files/dirs in shareprint(idmc_share.list())# write binary stringwithidmc_share.open('b_tmp','wb')asb_tmp:b_tmp.write(b'sadasdasd')# Get a _io.SFTPFileHandle object with automatic closewithidmc_share.open('b_tmp','rb')astmp:print(tmp.read())# Get a default _io.TextIOWrapper object with manual lifetimefile=idmc_share.open('b_tmp','rb')print(file.read())file.close()

欢迎加入QQ群-->: 979659372 Python中文网_新手群

推荐PyPI第三方库


热门话题
java嵌套循环打印一个数字,旁边有相同数量的星号   java JodReports替代方案   java如何将模型类parcelable对象从片段传递到活动?   java JCS缓存删除功能不删除特定元素   如何打开。Java的dll文件。   java在这种情况下如何选择聚合根?   java从CellEditorListener获取编辑的TreeNode   Java到web服务和mysql   从openssl ec在Java中创建公钥时出现加密无效密钥异常   Java数组:添加多个数组的元素时忽略空数组   java在初始化后向fragment发送数据   JButtons的java数组正在返回void   若联接列不包含特定值,则java JPA条件生成器仅返回实体   java ActionBar问题:NPE   java Portlet是被广泛使用还是非常罕见?