def pull_profile_and_essays(username):
    url = PROFILE_URL % username
    print "Fetching profile HTML for", username + "... ",
    html = None
    for i in range(3):
        if i > 0:
            print "Retrying...",
        try:
            r = requests.get(url, cookies={'session': FLAGS.session_cookie})
            if r.status_code != 200:
                print "Error, HTTP status code was %d, not 200" % r.status_code
            else:
                html = r.content
                break
        except requests.exceptions.RequestException, e:
            print "Error completing HTTP request:", e
    if not html:
        print "Giving up."
        return None, None
    print "Parsing..."
    profile, essays = parse_profile_html(html)
    return profile, essays
Given a username, fetches the profile page and parses it.
dataset/ETHPy150Open everett-wetchler/okcupid/FetchProfiles.py/pull_profile_and_essays