Пример #1
0
 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
Пример #2
0
    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()
Пример #3
0
 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
Пример #4
0
 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 = ''
Пример #5
0
 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)
Пример #6
0
 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")
Пример #7
0
    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())
Пример #8
0
 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
Пример #9
0
    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)
Пример #10
0
Файл: ftp.py Проект: fywer/docx
 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.")
Пример #11
0
 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)
Пример #12
0
    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)
Пример #13
0
   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)
Пример #14
0
    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)))
Пример #16
0
    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)
Пример #17
0
    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
Пример #18
0
    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
        )
Пример #19
0
    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
Пример #20
0
 def __init__(self, site, login, password):
     """
     constructor
     """
     FTP.__init__(self, site, login, password)
Пример #21
0
 def __init__(self, url):
   FTP.__init__(self, url);
   self.log = logging.getLogger(__name__);
Пример #22
0
 def __init__(self, *arg, **args):
     FTP.__init__(self, *arg, **args)
     self.set_pasv(False)
Пример #23
0
 def __init__(self):
     '''
     Constructor
     '''
     self.fix_host = None
     FTP.__init__(self)
Пример #24
0
 def __init__(
     self, *args
 ):  #maybe there are other arguments, but I'm not implementing them here
     FTP.__init__(self, *args)
Пример #25
0
 def __init__(self, host):
     FTP.__init__(self, host)
Пример #26
0
 def __init__(self):
     self.fix_host = None
     FTP.__init__(self)
Пример #27
0
 def __init__(self, *args, **keywords):
     FTP.__init__(self, *args, **keywords)
Пример #28
0
 def __init__(self, site, login, password):
     """
     constructor
     """
     FTP.__init__(self, site, login, password)
Пример #29
0
 def __init__(*args, **kw):
     FTP.__init__(*args, **kw)
Пример #30
0
Файл: net.py Проект: mk-fg/fgc
	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)
Пример #31
0
	def __init__(self,host):
		FTP.__init__(self,host)