MCPcopy Create free account
hub / github.com/PierreGode/Ragnar / getAttributes

Method getAttributes

pager_lib/smb/SMBConnection.py:249–278  ·  view source on GitHub ↗

Retrieve information about the file at *path* on the *service_name*. :param string/unicode service_name: the name of the shared folder for the *path* :param string/unicode path: Path of the file on the remote server. If the file cannot be opened for reading, an :doc:`Operat

(self, service_name, path, timeout = 30)

Source from the content-addressed store, hash-verified

247 return results
248
249 def getAttributes(self, service_name, path, timeout = 30):
250 """
251 Retrieve information about the file at *path* on the *service_name*.
252
253 :param string/unicode service_name: the name of the shared folder for the *path*
254 :param string/unicode path: Path of the file on the remote server. If the file cannot be opened for reading, an :doc:`OperationFailure<smb_exceptions>` will be raised.
255 :return: A :doc:`smb.base.SharedFile<smb_SharedFile>` instance containing the attributes of the file.
256 """
257 if not self.sock:
258 raise NotConnectedError('Not connected to server')
259
260 results = [ ]
261
262 def cb(info):
263 self.is_busy = False
264 results.append(info)
265
266 def eb(failure):
267 self.is_busy = False
268 raise failure
269
270 self.is_busy = True
271 try:
272 self._getAttributes(service_name, path, cb, eb, timeout)
273 while self.is_busy:
274 self._pollForNetBIOSPacket(timeout)
275 finally:
276 self.is_busy = False
277
278 return results[0]
279
280 def getSecurity(self, service_name, path, timeout = 30):
281 """

Callers

nothing calls this directly

Calls 2

_pollForNetBIOSPacketMethod · 0.95
NotConnectedErrorClass · 0.70

Tested by

no test coverage detected