• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Python commands.submit函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Python中twill.commands.submit函数的典型用法代码示例。如果您正苦于以下问题:Python submit函数的具体用法?Python submit怎么用?Python submit使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了submit函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。

示例1: login

def login():
    if s218:
        page = 'http://129.21.142.218:8008/securesync/login/'
        username = 'JSteacher'
        password = 'poipoi99'
        facility = '0939bcf9d5fe59ff8fde46b5a729a232'
    else:
        page = 'http://129.21.142.118:8008/securesync/login/'
        username = 'knowledgecraft'
        password = 'knowledgecraft'
        facility = 'dbae7005f9b45ce082b5fe0a0985946a'

    print 'Logging In...' 
    go(page)
    print "Forms:"
    showforms()
     
    try:
        # Force try using the first form found on a page.
        formclear('2')
        fv("2", "username", username)
        fv("2", "password", password)
        fv("2", "facility", facility)
        #fv("1", "csrfmiddlewaretoken", '3F1bMuIIM9ERzcp6ceEyFxlT51yJKsK6')
        submit('0')
        content = showSilently()
        print 'debug twill post content:', content
     
    except urllib2.HTTPError, e:
        sys.exit("%d: %s" % (e.code, e.msg))
开发者ID:Sintheros,项目名称:learninglandscape-codebase,代码行数:30,代码来源:loginToKALITE.py


示例2: upload

 def upload(self, input):
     self.get("/tool_runner/index?tool_id=upload1")
     tc.fv("1", "file_type", "bed")
     tc.fv("1", "dbkey", input.get('dbkey', '?'))
     tc.formfile("1", "file_data", input['file_path'])
     tc.submit("runtool_btn")
     tc.code(200)
开发者ID:ARTbio,项目名称:galaxy,代码行数:7,代码来源:check_galaxy.py


示例3: send

    def send(self, msg, *send_to):
        """
        @todo: make use of native vodafone multi-recipients functionality
        """
        for contact in send_to:
            web.follow(self.SERVICE_URL)

            try:
                web.find("/myv/messaging/webtext/Challenge.shtml")
            except twill.errors.TwillAssertionError, e:
                pass
            else:
                web.go("/myv/messaging/webtext/Challenge.shtml")
                with tempfile.NamedTemporaryFile(suffix=".jpeg") as captcha:
                    web.save_html(captcha.name)
                    web.back()
                    os.system("open %s " % captcha.name)
                    web.formvalue("WebText", "jcaptcha_response", raw_input("Captcha: "))

            web.formvalue("WebText", "message", msg)
            to = getattr(contact, "mobile", contact)
            web.formvalue("WebText", "recipient_0", to)

            web.sleep(2)
            web.submit()
            web.code(200)
            web.find("Message sent!")
开发者ID:lukmdo,项目名称:smsgates,代码行数:27,代码来源:contrib.py


示例4: main

def main():

    login, password = get_credentials()

    # log-in to Django site
    if login and password:
        tw.go(LOGIN_URL)
        tw.formvalue('1', 'username', login)
        tw.formvalue('1', 'password', password)
        tw.submit()

    if isinstance(DATA_URL, basestring):
        urls = [DATA_URL]
    else:
        urls = list(DATA_URL)

    # retrieve URIs
    for url in urls:
        try:
            tw.go(url)
            tw.code('200')
            tw.show()
        except TwillAssertionError:
            code = get_browser().get_code()           
            print (u"Unable to access %(url)s. "
                   u"Received HTTP #%(code)s."
                   % {'url': url, 'code': code})
    tw.reset_browser()
开发者ID:yeleman,项目名称:red_nut,代码行数:28,代码来源:refresh_cache.py


示例5: refresh_form

 def refresh_form(self, control_name, value, form_no=0, form_id=None, form_name=None, **kwd):
     """Handles Galaxy's refresh_on_change for forms without ultimately submitting the form"""
     # control_name is the name of the form field that requires refresh_on_change, and value is
     # the value to which that field is being set.
     for i, f in enumerate(self.showforms()):
         if i == form_no or (form_id is not None and f.id == form_id) or (form_name is not None and f.name == form_name):
             break
     formcontrols = self.get_form_controls(f)
     try:
         control = f.find_control(name=control_name)
     except Exception:
         log.debug('\n'.join(formcontrols))
         # This assumes we always want the first control of the given name, which may not be ideal...
         control = f.find_control(name=control_name, nr=0)
     # Check for refresh_on_change attribute, submit a change if required
     if 'refresh_on_change' in control.attrs.keys():
         # Clear Control and set to proper value
         control.clear()
         tc.fv(f.name, control.name, value)
         # Create a new submit control, allows form to refresh, instead of going to next page
         control = ClientForm.SubmitControl('SubmitControl', '___refresh_grouping___', {'name': 'refresh_grouping'})
         control.add_to_form(f)
         control.fixup()
         # Submit for refresh
         tc.submit('___refresh_grouping___')
开发者ID:osallou,项目名称:galaxy,代码行数:25,代码来源:twilltestcase.py


示例6: setup

    def setup(
        self,
        login=None,
        password=None,
        service_url="https://bramka.play.pl",
        login_url="https://logowanie.play.pl/p4-idp2/LoginForm.do",
        logout_url="https://logowanie.play.pl/p4-idp2/LogoutUser",
    ):
        self.SERVICE_URL = service_url
        self.LOGIN_URL = login_url
        self.LOGOUT_URL = logout_url
        self.MY_PHONE_NUMBER = login
        self.MY_PASSWORD = password

        web.config("readonly_controls_writeable", True)
        web.agent(self.MY_HTTP_AGENT)

        web.go(self.SERVICE_URL)
        web.submit()
        web.code(200)
        web.formvalue("loginForm", "login", self.MY_PHONE_NUMBER)
        web.formvalue("loginForm", "password", self.MY_PASSWORD)
        web.submit()
        web.code(200)
        self._retry_find("editableSmsComposeForm", 5)
开发者ID:lukmdo,项目名称:smsgates,代码行数:25,代码来源:contrib.py


示例7: make_intranets

def make_intranets(intranets_name):
    """ Make the offices root hierarchy, deleting if it exists"""

    global_dict, local_dict = namespaces.get_twill_glocals()

    global_dict['intranets_name'] = intranets_name

    # Check to see if we have that community, if so, delete it.
    commands.go('/' + intranets_name)
    br = get_browser()
    status = br.get_code()
    if status != 404:
        # The community shouldn't exist, and so we should get 404
        # looking for it.  If no 404, then it exists and we should
        # delete it.
        url = "/%s/delete.html?confirm=1" % intranets_name
        commands.go(url)

    # Now, make the community and make sure it exists
    commands.go("/add_community.html")
    commands.fv("save", "title", intranets_name)
    desc = "Test intranets root created for Twill test case named '%s'"
    commands.fv("save", "description", desc % test_name)
    commands.submit()
    commands.find("Add Existing")
开发者ID:Falmarri,项目名称:karl,代码行数:25,代码来源:twillcommands.py


示例8: create

 def create(self, cntrller='user', email='[email protected]', password='testuser', username='admin-user', redirect=''):
     # HACK: don't use panels because late_javascripts() messes up the twill browser and it
     # can't find form fields (and hence user can't be logged in).
     params = dict(cntrller=cntrller, use_panels=False)
     self.visit_url("/user/create", params)
     tc.fv('registration', 'email', email)
     tc.fv('registration', 'redirect', redirect)
     tc.fv('registration', 'password', password)
     tc.fv('registration', 'confirm', password)
     tc.fv('registration', 'username', username)
     tc.submit('create_user_button')
     previously_created = False
     username_taken = False
     invalid_username = False
     try:
         self.check_page_for_string("Created new user account")
     except Exception:
         try:
             # May have created the account in a previous test run...
             self.check_page_for_string("User with that email already exists")
             previously_created = True
         except Exception:
             try:
                 self.check_page_for_string('Public name is taken; please choose another')
                 username_taken = True
             except Exception:
                 try:
                     # Note that we're only checking if the usr name is >< 4 chars here...
                     self.check_page_for_string('Public name must be at least 4 characters in length')
                     invalid_username = True
                 except Exception:
                     pass
     return previously_created, username_taken, invalid_username
开发者ID:osallou,项目名称:galaxy,代码行数:33,代码来源:twilltestcase.py


示例9: find_price

def find_price(name, vintage, volume):

	formlist = []
	#com.showforms()
	all_forms = cbrw.get_all_forms()
	for each_form in all_forms:
		formlist.append(each_form.name)
	if 'searchform' in formlist:
		com.formclear("searchform")
		com.fv("searchform", "Xwinename", name)
		com.fv("searchform", "Xvintage", vintage)
		com.fv("searchform", "Xstateid", "CA")
		com.fv("searchform", "Xbottle_size", "Bottles")
		#com.fv("searchform", "Xprice_set", "CUR")
		com.submit()    
		url = com.browser.get_url()
		#print url

		page=urllib2.urlopen(url)

		soup = BeautifulSoup(page.read())
		prices=soup.findAll('span',{'class':'offer_price boldtxt'})

		price_values = []
		for price in prices:
			#print float((price.next).replace(",", ""))
			price_values.append(float((price.next).replace(",", "")))

		if len(price_values) > 0:
			return min(price_values), max(price_values), np.mean(price_values)
		else:
			return 'unknown', 'unknown', 'unknown'
	else:
		return 'unknown', 'unknown', 'unknown'
开发者ID:tapomayukh,项目名称:pyFunda,代码行数:34,代码来源:web_parser.py


示例10: login

def login(username):
    """Find user for given username and make the browser logged in"""

    global_dict, local_dict = namespaces.get_twill_glocals()

    # Set a globabl Twill variable to let Twill scripts now the name
    # of the test, e.g. the directory, as well as community name.
    #global_dict['test_name'] = test_name
    #global_dict['community_name'] = test_name + "-testcase"
    global_dict['cwd'] = os.getcwd()

    hn = global_dict['localhost_url']

    # First logout
    logout()

    # Do a login
    au = global_dict['%s_user' % username]

    # Echo to screen
    dump("Logging into %s as %s" % (hn, au))

    # Continue
    ap = global_dict['%s_password' % username]
    commands.go(hn + '/login.html')
    commands.fv("formLogin", "login", au)
    commands.fv("formLogin", "password", ap)
    commands.submit()

    # Make sure the login succeeded
    commands.show()
    commands.find("My Profile")
开发者ID:Falmarri,项目名称:karl,代码行数:32,代码来源:twillcommands.py


示例11: test_project_manager_sharing

    def test_project_manager_sharing(self):
        # test sharing as a manager

        # main page
        tc.go( testlib.PROJECT_LIST_URL )
        tc.find("Logged in as") 
        
        # default project list
        tc.find("Yeast mutant RAV 17") 
        tc.follow("Yeast mutant RAV 17")
        tc.follow("Sharing")
        tc.find("Current members")
        tc.find("Add access")

        # search for then add Demo User to this project
        tc.fv("1", "text", "demo" )
        tc.submit()
        tc.code(200)
        tc.find("Demo User")
        tc.follow("add as member")
        tc.find("Demo User")

        # back to the project view
        tc.follow("<< return to project")
        tc.find("Yeast mutant RAV 17") 
开发者ID:JCVI-Cloud,项目名称:galaxy-tools-prok,代码行数:25,代码来源:functional.py


示例12: login

def login(username, password):
    t.add_extra_header("User-Agent", "[email protected]")

    t.go(host + "index.php/Special:UserLogin")
    t.fv("1", "wpName", username)
    t.fv("1", "wpPassword", password)
    t.submit("wpLoginAttempt")
开发者ID:realsoc,项目名称:mediawiki-extensions,代码行数:7,代码来源:smtest.py


示例13: test_project_actions

    def test_project_actions(self):
        
        # main page
        tc.go( testlib.PROJECT_LIST_URL )
        tc.find("Logged in as") 

        # default project list
        tc.find("Fly data 19") 
        tc.find("Human HELA 16") 
        tc.find("Mouse project HBB 1") 


        # create a new project
        name = "Rainbow Connection - New Project"
        self.create_project(name=name)

        # visit this new project
        tc.follow(name)
        tc.code(200)
        tc.find("Project: %s" % name)

        # edit and rename project
        newname = "Iguana Garden - New Project"
        tc.follow("Edit")
        tc.find("Edit Project")
        tc.fv("1", "name", newname )
        tc.fv("1", "info", "Some other *markup* goes here")
        tc.submit()
        tc.code(200)
        tc.notfind(name)
        tc.find(newname)

        self.delete_project(name=newname)
开发者ID:JCVI-Cloud,项目名称:galaxy-tools-prok,代码行数:33,代码来源:functional.py


示例14: __init__

	def __init__ (self, email, password):
		Browser.go(PANDORA_LOGIN_URL)
		Browser.formvalue(1, 'login_username', email)
		Browser.formvalue(1, 'login_password', password)
		Browser.submit()

		self.webname = Browser.info().split('/').pop()
开发者ID:jfktrey,项目名称:Pandora-Unchained,代码行数:7,代码来源:PandoraUnchained.py


示例15: test_confirm_password_reset

 def test_confirm_password_reset(self):
     """
     create confirmation link as Django engine and
     test it for resetting password
     """
     test_email = '[email protected]'
     go(SITE)
     code(200)
     follow('reset password')
     code(200)
     fv(2, 'email', test_email)
     submit()
     code(200)
     #create links
     from django.contrib.auth.tokens import default_token_generator
     from django.utils.http import int_to_base36
     users = User.objects.filter(email__iexact=test_email)
     for user in users:
         link = "%s/accounts/password/reset_confirm/%s/%s/" % (SITE,
                 int_to_base36(user.id),
                 default_token_generator.make_token(user))
         go(link)
         code(200)
         find('Password reset confirm')
         fv(2, 'new_password1', 'test')
         fv(2, 'new_password2', 'test')
         submit()
         code(200)
         find('Your password was successfully reseted')
         self.general_login_action(user.username,
                                 'test',
                                 "Welcome, %s" % user.username)
开发者ID:xaratt,项目名称:andrytest,代码行数:32,代码来源:test.py


示例16: test_image_processing_library_error

    def test_image_processing_library_error(self):
        """
        If the image processing library errors while preparing a photo, report a
        helpful message to the user and log the error. The photo is not added
        to the user's profile.
        """
        # Get a copy of the error log.
        string_log = StringIO.StringIO()
        logger = logging.getLogger()
        my_log = logging.StreamHandler(string_log)
        logger.addHandler(my_log)
        logger.setLevel(logging.ERROR)

        self.login_with_twill()
        tc.go(make_twill_url('http://openhatch.org/people/paulproteus/'))
        tc.follow('photo')
        # This is a special image from issue166 that passes Django's image
        # validation tests but causes an exception during zlib decompression.
        tc.formfile('edit_photo', 'photo', photo('static/images/corrupted.png'))
        tc.submit()
        tc.code(200)

        self.assert_("Something went wrong while preparing this" in tc.show())
        p = Person.objects.get(user__username='paulproteus')
        self.assertFalse(p.photo.name)

        # an error message was logged during photo processing.
        self.assert_("zlib.error" in string_log.getvalue())
        logger.removeHandler(my_log)
开发者ID:boblannon,项目名称:oh-mainline,代码行数:29,代码来源:tests.py


示例17: dismod_server_login

def dismod_server_login():
    """ login to the dismod server given in dismod3/settings.py."""

    twc.go(DISMOD_LOGIN_URL)
    twc.fv("1", "username", DISMOD_USERNAME)
    twc.fv("1", "password", DISMOD_PASSWORD)
    twc.submit()
    twc.url("accounts/profile")
开发者ID:flaxter,项目名称:gbd,代码行数:8,代码来源:disease_json.py


示例18: authAndRedirect

def authAndRedirect(username, password):
    tw.reset_browser()
    tw.go(SYS_REDIRECT_URL)
    tw.fv('1', "username", username)
    tw.fv('1', "password", password)
    tw.formaction('1', AUTH_URL)
    tw.submit()
    return tw.get_browser().get_html()
开发者ID:liquiddandruff,项目名称:sfu-coursys-viewer,代码行数:8,代码来源:main.py


示例19: login

    def login(self):
        from twill import commands as b
        b.go('/login')
        b.fv('login', 'login', 'chris')
        b.fv('login', 'password', 'chris')
        b.submit()

        b.find('You are logged in as chris.')
开发者ID:chrisrossi,项目名称:edwin,代码行数:8,代码来源:twillbase.py


示例20: __create_session

    def __create_session(self):
        browser = get_browser()
        browser.go('http://www.erstenachhilfe.de/user?destination=node%2F767')
        tw.fv('2', 'edit-name', LOGIN)
        tw.fv('2', 'edit-pass', PASSWORD)
        tw.showforms()
        tw.submit('op')

        return browser
开发者ID:asholok,项目名称:adv-crawler,代码行数:9,代码来源:adv_crawler.py



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Python namespaces.get_twill_glocals函数代码示例发布时间:2022-05-27
下一篇:
Python commands.show函数代码示例发布时间:2022-05-27
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap