Minimum Intrusion Grid (MiG) Utilities library
Project description
A Minimum Intrusion Grid(MiG) utilities python library: It includes the mig.io module that provides access to MiG Sharelinks through python by wrapping around (https://github.com/althonos/fs.sshfs) for sshfs connections and (https://github.com/ParallelSSH/ssh2-python.git) for sftp which is the default and recommended connection
Installation
Installation from pypi
pip install mig-utils
Installation from a local git repository
cd mig-utils
pip install .
IO Example
ERDA (https://erda.dk) sharelink access with python3 example. A likewise sharelink class (IdmcShare) exists for IDMC (https://idmc.dk)
# First import the class that gives you access to the share in question*
from mig.io import ERDAShare, IDMCShare
# ERDA Sharelink example
print("ERDA")
# Open connection to a sharelink
erda_share = ERDAShare('SHARELINKID')
# List files/dirs in share
print(erda_share.list())
with erda_share.open('tmp', 'w') as tmp:
tmp.write("sdfsfsf")
# Get a _io.SFTPFileHandle object with automatic close
with erda_share.open('tmp', 'r') as tmp:
print(tmp.read())
# Get a default _io.SFTPFileHandle object with manual lifetime
file = erda_share.open('tmp', 'r')
print(file.read())
file.close()
# remove file
erda_share.remove('tmp')
print("\n")
# IDMC Sharelink example
print("IDMC")
# Open connection to a sharelink
idmc_share = IDMCShare('SHARELINKID')
# List files/dirs in share
print(idmc_share.list())
# write binary string
with idmc_share.open('b_tmp', 'wb') as b_tmp:
b_tmp.write(b'sadasdasd')
# Get a _io.SFTPFileHandle object with automatic close
with idmc_share.open('b_tmp', 'rb') as tmp:
print(tmp.read())
# Get a default _io.TextIOWrapper object with manual lifetime
file = idmc_share.open('b_tmp', 'rb')
print(file.read())
file.close()
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
mig-utils-0.1.7.2.tar.gz
(4.9 kB
view hashes)
Built Distributions
Close
Hashes for mig_utils-0.1.7.2-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 25067203f0141ec12c1b4fdede0f79b7d827c6c17b2b31c761d0eebc75a91332 |
|
MD5 | 14373a604c7235f4ad5d7c10473a90eb |
|
BLAKE2b-256 | 97c62c16817a68899981afa13c9c5f07f90193fed10cbf439e005159afd1e02f |
Close
Hashes for mig_utils-0.1.7.2-py2-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 4c0ce2ecc4fc4f74aa56cd71008515ffee821c3593d40d556d691d312826d7e8 |
|
MD5 | 22f6fa8850ef4838969e39c2b30d9db3 |
|
BLAKE2b-256 | 1b9d92ffcab37674a3d9658e46604f27703d15890d255bc59380f1a1e7b92d67 |