def install_opener():
    jar = cookielib.CookieJar()
    opener = urllib2.build_opener(urllib2.HTTPCookieProcessor(jar))
    # Amazon displays 'Please enable cookies (...)' without fake 'User-agent'
    # header.
    opener.addheaders = [('User-agent', 'Mozilla/5.0')]
    urllib2.install_opener(opener)
    return opener
Install global opener with cookies support.
dataset/ETHPy150Open ipeirotis/Mturk-Tracker/app/mturk/main/management/commands/crawler/auth.py/install_opener