当前位置: 首页>>代码示例>>Python>>正文


Python Browser.form['email']方法代码示例

本文整理汇总了Python中mechanize.Browser.form['email']方法的典型用法代码示例。如果您正苦于以下问题:Python Browser.form['email']方法的具体用法?Python Browser.form['email']怎么用?Python Browser.form['email']使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在mechanize.Browser的用法示例。


在下文中一共展示了Browser.form['email']方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: check

# 需要导入模块: from mechanize import Browser [as 别名]
# 或者: from mechanize.Browser import form['email'] [as 别名]
def check(acs):
    for a in acs:
        try:
            a = a.rsplit()[0]
        except:
            pass
        try:
            if a:
                a = a.split(':')
                user = a[0]
                passw = a[1]
                br = Browser()
                br.set_handle_gzip(True)
                br.set_handle_robots(False)
                br.addheaders = [('User-agent', 'Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.0.1) Gecko/2008071615 Fedora/3.0.1-1.fc9 Firefox/3.0.1')]
                br.open('http://m.facebook.com/login.php')
                br.select_form(nr=0)
                br.form['email'] = user
                br.form['pass'] = passw
                br.submit()
                if 'm.facebook.com/login.php' in br.geturl() or 'checkpoint' in br.geturl() or 'to confirm your account with Facebook.' in br.response().read():
                            print "Could not login with " + str(a)

                else:
                    print "Logged in with " + user
                    opn = open(newfile, 'a')
                    opn.write(user + ":" + passw + '\n')
                    opn.close()

        except:
            print "Could not login with " + str(a)
开发者ID:Rasmus-Riis,项目名称:Huge_py,代码行数:33,代码来源:facebookconnects.py

示例2: postfb

# 需要导入模块: from mechanize import Browser [as 别名]
# 或者: from mechanize.Browser import form['email'] [as 别名]
def postfb(args):
    fbuser,fbpass = get_creds(name="postfb")
    message =''
    message = "Oskar is doing sysadmin work on the Trello card: \n" \
              + "*** " + args.card + " ***" + "\n" + args.url + "\n" \
	      + "Status: " + args.status + "\n" + "Organization: " + "http://www.ovivo.dk"
    br = Browser()
    br.set_handle_robots(False)
    br.addheaders = [('User-agent','Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.0.1) Gecko/2008071615 Firefox/3.0.1')]
    br.open( "https://m.facebook.com/" )
    br.select_form(nr=0)
    br.form['email'] = fbuser
    br.form['pass'] = fbpass
    br.submit()
    br.open("https://m.facebook.com/upload.php?source_loc=composer&refid=7")
    br.select_form(nr=0)
    filepath = os.path.expanduser(os.path.join("~", "./trello2b.jpg"))
    br.form.add_file(open(filepath, 'rb'), 'text/plain', 'd6sEz.jpg', nr=0, name='file1')
    print br.form
    br.form["caption"] = message
    br.submit()
开发者ID:okossuth,项目名称:fbtrello,代码行数:23,代码来源:fbtrello.py

示例3: LWPCookieJar

# 需要导入模块: from mechanize import Browser [as 别名]
# 或者: from mechanize.Browser import form['email'] [as 别名]
url = 'https://www.amazon.com/ap/signin?_encoding=UTF8&openid.assoc_handle=usflex&openid.claimed_id=http%3A%2F%2Fspecs.openid.net%2Fauth%2F2.0%2Fidentifier_select&openid.identity=http%3A%2F%2Fspecs.openid.net%2Fauth%2F2.0%2Fidentifier_select&openid.mode=checkid_setup&openid.ns=http%3A%2F%2Fspecs.openid.net%2Fauth%2F2.0&openid.ns.pape=http%3A%2F%2Fspecs.openid.net%2Fextensions%2Fpape%2F1.0&openid.pape.max_auth_age=0&openid.return_to=https%3A%2F%2Fwww.amazon.com%2Fgp%2Fcss%2Fhomepage.html%3Fie%3DUTF8%26ref_%3Dgno_yam_ya'

cj = LWPCookieJar()

b = Browser()
b.set_cookiejar(cj)

b.set_handle_redirect(True)
b.set_handle_referer(True)
b.set_handle_robots(False)

b.set_debug_http(True)
b.set_debug_redirects(True)
b.set_debug_responses(True)

b.addheaders = [('User-agent', 'Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.0.1) Gecko/2008071615 Fedora/3.0.1-1.fc9 Firefox/3.0.1')]

b.open(url)
b.select_form(name = 'signIn')

email = 'email here'
password = 'pass here'

b.form['email'] = email
b.form['password'] = password

req = b.submit()

print req
开发者ID:bitcoinspring,项目名称:proj,代码行数:31,代码来源:mechanize-amazon.py

示例4: dictionary

# 需要导入模块: from mechanize import Browser [as 别名]
# 或者: from mechanize.Browser import form['email'] [as 别名]
    dictionary = json.load(f) 
  return dictionary
dictionary = dictionary()

# def run():
br = Browser()
br.set_handle_robots( False )
url = 'https://www.facebook.com/login/'
html = urllib2.urlopen(url)


br.open(url)


br.form = list(br.forms())[0]
br.form['email'] = '[email protected]'
br.form['pass'] = 'ItsaSunnyDay62'
req = br.submit()

html = req.read()
	
f = open('facebooktext.txt', 'w')
f.write(html)
f.close()


matches = re.findall(r"<p>([a-zA-Z0-9 !-)(?.,;:'\"_+= -]*)", open('facebooktext.txt', 'r').read())
os.remove('C:\Python27\mockingbird\\facebooktext.txt')

with open('facebook_dictionary.json', 'r') as fb:
  fb_dictionary = json.load(fb)
开发者ID:dallincoons,项目名称:mockingbird,代码行数:33,代码来源:fbread.py


注:本文中的mechanize.Browser.form['email']方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。