Exemple #1
0
    br = mechanize.Browser()
    #   br.set_proxies({"http":"localhost:8080"})
    br.set_handle_robots(False)
    br.addheaders = [(
        "User-agent",
        "Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.2.13) Gecko/20101206 Ubuntu/10.10 (maverick) Firefox/3.6.13"
    )]

    sign_in = br.open("http://www.amazon.com/gp/flex/sign-out.html")

    br.select_form(name="sign-in")
    if options.username != None:
        br["email"] = options.username
        br["password"] = options.password
    else:
        while kr.get_user("Amazon") is None:
            user = raw_input('Amazon user name:')
            password = raw_input('Amazon password:'******'Save (y/N)?').lower().startswith('y')
            if ok:
                kr.set_password("Amazon", user, password)
    # set your static credentials here if you want
    br["email"] = kr.get_user("Amazon")
    br["password"] = kr.get_password("Amazon")
    logged_in = br.submit().read()

    error_str = "The e-mail address and password you entered do not match any accounts on record."
    if error_str in logged_in:
        print error_str
        sys.exit(1)
    #print "Successfully logged in!"
Exemple #2
0
    #time.sleep(random.randint(1,120))
    options = getOptions()

    br = mechanize.Browser()
#   br.set_proxies({"http":"localhost:8080"})
    br.set_handle_robots(False)
    br.addheaders = [("User-agent", "Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.2.13) Gecko/20101206 Ubuntu/10.10 (maverick) Firefox/3.6.13")]

    sign_in = br.open("http://www.amazon.com/gp/flex/sign-out.html")

    br.select_form(name="sign-in")
    if options.username != None:
        br["email"] = options.username
        br["password"] = options.password
    else:
        while kr.get_user("Amazon") is None:
            user = raw_input('Amazon user name:')
            password = raw_input('Amazon password:'******'Save (y/N)?').lower().startswith('y')
            if ok:
                kr.set_password("Amazon", user, password)
    # set your static credentials here if you want
    br["email"] = kr.get_user("Amazon")
    br["password"] = kr.get_password("Amazon")
    logged_in = br.submit().read()

    error_str = "The e-mail address and password you entered do not match any accounts on record."
    if error_str in logged_in:
        print error_str
        sys.exit(1)
    #print "Successfully logged in!"