Retrieve a list of shared resources on remote server. :return: A list of :doc:`smb.base.SharedDevice ` instances describing the shared resource
(self, timeout = 30)
| 141 | self.sock = None |
| 142 | |
| 143 | def listShares(self, timeout = 30): |
| 144 | """ |
| 145 | Retrieve a list of shared resources on remote server. |
| 146 | |
| 147 | :return: A list of :doc:`smb.base.SharedDevice<smb_SharedDevice>` instances describing the shared resource |
| 148 | """ |
| 149 | if not self.sock: |
| 150 | raise NotConnectedError('Not connected to server') |
| 151 | |
| 152 | results = [ ] |
| 153 | |
| 154 | def cb(entries): |
| 155 | self.is_busy = False |
| 156 | results.extend(entries) |
| 157 | |
| 158 | def eb(failure): |
| 159 | self.is_busy = False |
| 160 | raise failure |
| 161 | |
| 162 | self.is_busy = True |
| 163 | try: |
| 164 | self._listShares(cb, eb, timeout) |
| 165 | while self.is_busy: |
| 166 | self._pollForNetBIOSPacket(timeout) |
| 167 | finally: |
| 168 | self.is_busy = False |
| 169 | |
| 170 | return results |
| 171 | |
| 172 | def listPath(self, service_name, path, |
| 173 | search = SMB_FILE_ATTRIBUTE_READONLY | SMB_FILE_ATTRIBUTE_HIDDEN | SMB_FILE_ATTRIBUTE_SYSTEM | SMB_FILE_ATTRIBUTE_DIRECTORY | SMB_FILE_ATTRIBUTE_ARCHIVE | SMB_FILE_ATTRIBUTE_INCL_NORMAL, |
no test coverage detected