예제 #1
0
    def __init__(self,
                 server,
                 use_ssl,
                 username,
                 password,
                 record=False,
                 replay=False,
                 max_messages=-1,
                 random_subset=False):
        self.__server = server
        self.__username = username
        self.__record = record
        self.__replay = replay
        self.__max_messages = max_messages
        self.__random_subset = random_subset

        self.__current_mailbox = None

        if record or replay:
            self.__cache = cache.FileCache()

        imap_constructor = use_ssl and imaplib.IMAP4_SSL or imaplib.IMAP4

        logging.info("Connecting")

        self.__mail = imap_constructor(server)

        logging.info("Logging in")

        self.__mail.login(username, password)
예제 #2
0
    def __init__(self, local_endpoint, local_path, remote_endpoint):
        """Initialize the FUSE wrapper.

        Args:
            local_endpoint: Name of the Globus endpoint running locally.
            local_path: Directory visible to the local endpoint. Cache will be stored under this
                directory.
            remote_endpoint: Name of the remote endpoint to be mounted.
        """
        # Wrapper around the globus API.
        self.api = api.GlobusAPI(local_endpoint, remote_endpoint)

        # Cache file metadata in memory.
        self.metadata = cache.MetaData(self.api)

        # Cache file data in local endpoint.
        self.file_cache = cache.FileCache(self.api, local_path)

        print 'Ready!'
예제 #3
0
    def __init__(self,
                 server,
                 use_ssl,
                 username,
                 password,
                 days,
                 date_from,
                 record=False,
                 replay=False,
                 max_messages=-1,
                 random_subset=False):

        self.__date_to = (date_from -
                          datetime.timedelta(int(days))).strftime("%d-%b-%Y")
        date_from = date_from.strftime("%d-%b-%Y")
        search_dates = '(SENTBEFORE {date_from} SENTSINCE {date_to})'.format(
            date_to=self.__date_to, date_from=date_from)
        self.__search_dates = search_dates

        self.__server = server
        self.__username = username
        self.__record = record
        self.__replay = replay
        self.__max_messages = max_messages
        self.__random_subset = random_subset

        self.__current_mailbox = None

        if record or replay:
            self.__cache = cache.FileCache()

        imap_constructor = use_ssl and imaplib.IMAP4_SSL or imaplib.IMAP4

        logging.info("Connecting")

        self.__mail = imap_constructor(server)

        logging.info("Logging in")

        self.__mail.login(username, password)

        self.__prefix = None