imaplib_connect.py 文件源码

python
阅读 17 收藏 0 点赞 0 评论 0

项目:pymotw3 作者: reingart 项目源码 文件源码
def open_connection(verbose=False):
    # Read the config file
    config = configparser.ConfigParser()
    config.read([os.path.expanduser('~/.pymotw')])

    # Connect to the server
    hostname = config.get('server', 'hostname')
    if verbose:
        print('Connecting to', hostname)
    connection = imaplib.IMAP4_SSL(hostname)

    # Login to our account
    username = config.get('account', 'username')
    password = config.get('account', 'password')
    if verbose:
        print('Logging in as', username)
    connection.login(username, password)
    return connection
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号