MCPcopy
hub / github.com/lanjelot/patator / execute

Method execute

patator.py:1819–1845  ·  view source on GitHub ↗
(self, host, port='21', tls='0', user=None, password=None, timeout='10', persistent='1')

Source from the content-addressed store, hash-verified

1817 return TCP_Connection(fp, banner)
1818
1819 def execute(self, host, port='21', tls='0', user=None, password=None, timeout='10', persistent='1'):
1820
1821 try:
1822 with Timing() as timing:
1823 fp, resp = self.bind(host, port, tls, timeout=timeout)
1824
1825 if user is not None or password is not None:
1826 with Timing() as timing:
1827
1828 if user is not None:
1829 resp = fp.sendcmd('USER ' + user)
1830
1831 if password is not None:
1832 resp = fp.sendcmd('PASS ' + password)
1833
1834 logger.debug('No error: %r' % resp)
1835 self.reset()
1836
1837 except FTP_Error as e:
1838 logger.debug('FTP_Error: %s' % e)
1839 resp = str(e)
1840
1841 if persistent == '0':
1842 self.reset()
1843
1844 code, mesg = resp.split(' ', 1)
1845 return self.Response(code, mesg, timing)
1846
1847# }}}
1848

Callers

nothing calls this directly

Calls 5

TimingClass · 0.85
bindMethod · 0.80
sendcmdMethod · 0.80
debugMethod · 0.80
resetMethod · 0.80

Tested by

no test coverage detected