Login to website using python

I would recommend using the wonderful requests module.

The code below will get you logged into the site and persist the cookies for the duration of the session.

import requests
import sys

EMAIL = ''
PASSWORD = ''

URL = 'http://friends.cisv.org'

def main():
    # Start a session so we can have persistant cookies
    session = requests.session(config={'verbose': sys.stderr})

    # This is the form data that the page sends when logging in
    login_data = {
        'loginemail': EMAIL,
        'loginpswd': PASSWORD,
        'submit': 'login',
    }

    # Authenticate
    r = session.post(URL, data=login_data)

    # Try accessing a page that requires you to be logged in
    r = session.get('http://friends.cisv.org/index.cfm?fuseaction=user.fullprofile')

if __name__ == '__main__':
    main()

The term "login" is unfortunately very vague. The code given here obviously tried to log in using HTTP basic authentication. I'd wager a guess that this site wants you to send it a username and password in some kind of POST form (that's how most web-based login forms work). In this case, you'd need to send the proper POST request, and keep whatever cookies it sent back to you for future requests. Unfortunately I don't know what this would be, it depends on the site. You'll need to figure out how it normally logs a user in and try to follow that pattern.