用于windows的unc网络驱动器处理和安装
win_unc的Python项目详细描述
Win_unc
用于在windows上处理unc路径的python库。
使用此库,您可以
- Connect UNC directories to your Windows session
- Connect UNC directories requiring authorization by providing credentials
- Mount UNC directories (with or without credentials) to a local mount point
- Disconnect/unmount UNC connections
- Query existing UNC connections known by the Windows session
完整文档位于http://covenanteyes.github.com/py_win_unc
在包的github页面上报告任何问题:http://github.com/CovenantEyes/py_win_unc
安装
要安装:
$ pip install win_unc
偷偷预览
下面是一个简单的示例:
from win_unc import UncDirectoryMount, UncDirectory, DiskDrive conn = UncDirectoryMount(UncDirectory(r'\home\shared'), DiskDrive('Z:')) conn.mount() print 'Drive connected:', conn.is_mounted() conn.unmount()
您还可以提供以下凭据:
from win_unc import UncCredentials unc = UncDirectory(r'\home\shared', UncCredentials('user', 'pwd')) conn = UncDirectoryMount(unc, DiskDrive('Z:'))
或者只连接路径而不安装:
from win_unc import UncDirectoryConnection conn = UncDirectoryConnection(r'\home\shared') conn.connect()