def __init__(self): FTP.__init__(self, env_variables.ftp_server) try: self.login(env_variables.ftp_login, self._get_word()) except Exception: logging.error("could not log in on FTP server", exc_info=True) raise RuntimeError
def __init__(self, hostname, username, password, wd, pattern=None, log=None, autologin=False): # read options self.hostname = hostname self.username = username self.password = password self.wd = wd if not pattern: self.pattern = ".*" else: self.pattern = pattern if not log: self.log = self._log else: self.log = log # set defaults self.connected = False self.pattern_compiled = re.compile(self.pattern) # initialize FTP connector FTP.__init__(self, self.hostname) # login to the remote site if autologin: self.login()
def __init__(self, host, user='', password='', port=21): """Build ftp manager""" FTP.__init__(self, timeout=TIMEOUT) self.host = host self.user = user self.port = port self.password = password
def __init__(self, host, user, password, is_pasv=False): FTP.__init__(self) self.host = host self.user = user self.password = password self.set_pasv(is_pasv) self._ftp = None self.root_path = ''
def __init__(self, *args, **kwargs): _FTP.__init__(self, *args, **kwargs) self._laftp_config = {} from rsab.listenagain import config, ListenAgainConfigError SECTION_NAME = 'ftp' for config_key, key in [ ('audio_path', 'audio_path'), ]: if not config.has_option(SECTION_NAME, config_key): raise ListenAgainConfigError('Missing option', SECTION_NAME, config_key) self._laftp_config[key] = config.get(SECTION_NAME, config_key)
def __init__(self, con): if con: host, user, pwd, self.path, self.lpath = muftpconsts[con] print(host, user, pwd) if not pwd: pwd = getpass.getpass("Mot de passe : ") try: FTP.__init__(self, host, user, pwd) print("Connexion réussie") print(self.getwelcome()) except: print("Connexion refusée")
def __init__(self, host, userid, password): FTP.__init__(self) try: self.connect(host) except: print("FTP server is not responsing, try again") try: self.login(userid, password) except: print("Cant to log in, try again") print(self.getwelcome())
def __init__(self,hote,debug,dry_run = 0): FTP.__init__(self,hote) self.set_debuglevel(debug) netrc = ftplib.Netrc() uid,passwd,acct = netrc.get_account(hote) self.login(uid,passwd,acct) self.setSymlinks() self._paths = [ "/" ] self._use_regexp = 0 self._regexp_list = [] self._dry_run = dry_run
def __init__(self, site, login, password, fLOG=noLOG): """ constructor @param site website @param login login @param password password @param fLOG logging function """ FTP.__init__(self, site, login, password) self.LOG = fLOG self._atts = dict(site=site)
def __init__(self): FTP.__init__(self) try: bienvenido = self.connect(host=self.__host, port=self.__port, timeout=self.__timeout) loggeado = self.login(user=self.__user, passwd=self.__password) log.info(loggeado) proceso = Proceso(self) proceso.start() except Exception as e: raise Exception("Error en el API FTP.")
def __init__(self, host, user, password, port=21): ''' Start the connection ''' self.ok = False try: FTP.__init__(self) self.set_debuglevel(2) logger.debug('host (%s) port (%s)' % (host, port)) self.connect(host, port) self.login(user, password) self.ok = True except all_errors, msg: logger.error(msg)
def __init__(self, host=''): """Create a new FTP_TLS instance. secureConnection is a function that takes a socket as its argument and returns a socket object that will send and recv using TLS. If the optional host argument is provided, a connection will be established using connect(host). No automatic login is provided, as the client must decide when and whether to request encrypted connections.""" self.secureConnection = secureSocket self.control_state = 0 self.data_state = 0 FTP.__init__(self, host)
def __init__(self, host, username, port=21, password=None): FTP.__init__(self, host) self.host = host self.port = port self.username = username self.password = password try: self.connect(self.host) except ftplib.all_errors: raise ConnectionException(username, password) try: self.login(username, password) except ftplib.all_errors: raise AuthenticationException(username, OPOPpassword)
def __init__(self): try: FTP.__init__(self, local_config['FTP_Server'].decrypt()) try: self.login(local_config['FTP_User'].decrypt(), local_config['FTP_Pass'].decrypt()) except Exception as err: self.quit() tool.write_to_log(traceback.format_exc(), 'critical') tool.write_to_log("Credentials - Error Code '{0}', {1}".format( type(err).__name__, str(err))) except Exception as err: tool.write_to_log(traceback.format_exc(), 'critical') tool.write_to_log("Connect - Error Code '{0}', {1}".format( type(err).__name__, str(err)))
def __init__(self, owner="", host=""): if DEBUGGING_MSG: print "DEBUG, host : ", host self.owner = owner self.instr_queue = Queue.Queue() self.resp_queue = Queue.Queue() # responses, in order. self.conn = None # connection socket self.callback = None self.chunks = [] self.chunk_size = 2504 self.resp_RETR = False # When set, puts chunk/frame num in resp_queue after received. self.end_flag = False FTP.__init__(self) host_ip_address = host[0] host_port_num = host[1] self.host_address = (host_ip_address, host_port_num) FTP.connect(self, host_ip_address, host_port_num, 3) # FTP.__init__(self, host, user, passwd, acct, timeout) threading.Thread.__init__(self)
def download(self, basedir): self.localdirname = os.path.join(basedir, self.get_local_dir_from_ftp_dir()) self.localfilename = self.localdirname + self.filename if not os.path.exists(self.localfilename): logging.info('Downloading \'%s\' to \'%s\', please wait...', self.url.get_url(), self.localdirname) with open(self.localfilename, 'wb') as f: def callback(data): f.write(data) FTP.__init__(self, self.sitename) self.login() FTP.retrbinary(self, cmd='RETR {}'.format(self.ftpfilename), callback=callback) self.quit
def __init__(self, area=None, year=None, month=None, *args, **kwargs): self.files = [] self._f = None self.checked = False self.area = area self.year = year self.month = month if not self.year: self.year = datetime.today().year if not self.month: self.month = datetime.today().month self.path = "%s/%s/%s" % (self.year, self.month, self.area) FTP.__init__( self, host=app_settings.REPORTS_SOURCE['host'], user=app_settings.REPORTS_SOURCE['user'], passwd=app_settings.REPORTS_SOURCE['passwd'], *args, **kwargs )
def __init__(self,host,path,logger=logging.getLogger("MyFTP")): self.logger = logger FTP.__init__(self) self.__isConnected = False try: self.connect(host) except Exception as inst: self.logger.error("FTP: %s"%inst) else: netrc.netrc.__init__(self) auth = self.authenticators(host) try: self.login(auth[0],auth[2]) except Exception as inst: self.logger.error("FTP: %s"%inst) else: try: self.cwd(path) except Exception as inst: self.logger.error("FTP: %s"%inst) else: self.__isConnected = True
def __init__(self, site, login, password): """ constructor """ FTP.__init__(self, site, login, password)
def __init__(self, url): FTP.__init__(self, url); self.log = logging.getLogger(__name__);
def __init__(self, *arg, **args): FTP.__init__(self, *arg, **args) self.set_pasv(False)
def __init__(self): ''' Constructor ''' self.fix_host = None FTP.__init__(self)
def __init__( self, *args ): #maybe there are other arguments, but I'm not implementing them here FTP.__init__(self, *args)
def __init__(self, host): FTP.__init__(self, host)
def __init__(self): self.fix_host = None FTP.__init__(self)
def __init__(self, *args, **keywords): FTP.__init__(self, *args, **keywords)
def __init__(*args, **kw): FTP.__init__(*args, **kw)
def __init__(self, host='', user='', passwd='', acct='', keyfile=None, certfile=None, timeout=_GLOBAL_DEFAULT_TIMEOUT): self.keyfile = keyfile self.certfile = certfile self._prot_p = False FTP.__init__(self, host, user, passwd, acct, timeout)
def __init__(self,host): FTP.__init__(self,host)