| Name | Modified | Size | Downloads / Week |
|---|---|---|---|
| V01 | 2011-11-16 | ||
| Readme.txt | 2011-11-16 | 1.5 kB | |
| Totals: 2 Items | 1.5 kB | 0 |
WNetConnect is a python class (NetAddConnection) that exposes Win32 mpr.dll functions
- WNetAddConnection2A - a function that can redirect a local device to a network resource such as a webDAV drive
- WNetUseConnection - a function that can redirect an unused local device to a network resource
- WNetCancelConnection - disconnects a local device from a network resource
Using NetAddConnection looks like this in python:
nac = NetAddConnection()
#mount WebDAV server at http://localhost:8081 on X:
result = nac.GetNetworkConnection('X:',
'http://localhost:8081',
'bob@shinkuro.com',
'bob')
assert result, 'GetNetworkConnection failed'
#disconnect X:
result = nac.Disconnect('X:', False)
assert result, 'Disconnect failed'
#mount WebDAV server at http://localhost:8081 on the next unused local device
#returns the local device or None
result = nac.GetUnusedNetworkConnection('http://localhost:8081',
'bob@shinkuro.com',
'bob')
assert isinstance(result, basestring) and len(result) > 0, 'GetUnusedNetworkConnection failed'
print 'connected to %s' % result
#disconnect the local device mounted above
result = nac.Disconnect(result, False)
assert result, '2nd Disconnect failed'