最小入侵网格(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如何从具有相同类名的div中选择元素(Selenium)   Java制作纸牌游戏,有关于类的问题吗   bluej在Java中使用变异器和访问器设置颜色和圆半径   java准确定位异常错误的最佳方法是什么?   使用多个监视器时的java设置对话框位置   java如何在不使用JavascriptExecutor的情况下在网页中向下/向上滚动   java在for循环中将大小设置为n   java为什么akka需要不可变的消息   java LdapInvalidDnException:意外标记:   java如果字符串的第一个字母不是一个,如何大写?   使用htmlunit的java html内容提取   java从CDI托管bean获取方法的注释   java有办法在运行时检查post请求参数的大小吗   java我可以将实体注入托管Bean并直接持久化吗?