English 中文(简体)
pthon Mechanicalze javascript submitting button problem!
原标题:python mechanize javascript submit button problem!

采用机械设备。 browser模块。

问题之一是ok,但何时提交(a) 形式、不工作

因此,发现了一些怀疑来源。

在html来源中,发现有这样的情况。

im,在提交表格时造成问题。

可是,如何用机械化模块处理这种束缚器功能,等等。

成功提交表格,并能够收到结果?

下面是网络资源配置,与日志节制功能有关。

        function init(){
        FRMLOGIN.ID.focus();
    }

    function loginCheck(f){
        if(chkNull(f.ID, "아이디를"))
            return false;

        if(chkNull(f.PWD, "패스워드를"))
            return false;

        //f.target = "ifrmLoginHidden";
        f.action = (f.SECCHK.checked) ? "https://user.buddybuddy.co.kr/Login/Login.asp" : "http://user.buddybuddy.co.kr/Login/Login.asp";
    }

i) 知道机械师不支持 j,因此,想要做gam木。

运行时有 p机。

你们有些人会帮助我把这一 j印功能变成了 p。

翻译守则

这样,网站就能够正确登录。

敬请!

    # -*- coding: cp949-*-
import sys,os
import mechanize, urllib
import cookielib
from BeautifulSoup import BeautifulSoup,BeautifulStoneSoup,Tag
import datetime, time, socket
import re,sys,os,mechanize,urllib,time


br = mechanize.Browser()
cj = cookielib.LWPCookieJar()
br.set_cookiejar(cj)

# Browser options
br.set_handle_equiv(True)
br.set_handle_gzip(True)
br.set_handle_redirect(True)
br.set_handle_referer(True)
br.set_handle_robots(False)

# Follows refresh 0 but not hangs on refresh > 0
br.set_handle_refresh(mechanize._http.HTTPRefreshProcessor(), max_time=1)

# Want debugging messages?
br.set_debug_http(True)
br.set_debug_redirects(True)
br.set_debug_responses(True)

# User-Agent (this is cheating, ok?)
br.addheaders = [( User-agent ,  Mozilla/5.0 (Windows; U; Windows NT 6.0; en-US; rv:1.9.0.6 )]
br.open( http://user.buddybuddy.co.kr/Login/LoginForm.asp?URL= )
html = br.response().read()
print html

br.select_form(name= FRMLOGIN )
print br.viewing_html()
br.form[ ID ]= psh7943 
br.form[ PWD ]= qkrthgus 
br.submit()

print br.response().read()

如果有人能帮助我,那将不胜感激!

问题回答

可以通过手提和核对(例如使用)来完成标识过程。 火f中的燃烧, Chrome的研制工具等,当你打到Kutton时,这些要求被送到现场。 通常,这是一份包含从标识表中提取数据的持久性有机污染物清单。 检查在这项请求中发送的数据,并履行你自己的职位要求:

mechanize.urlopen(URL, POST_DATA). 

您可使用下列仪器从机械化物体中提取POST_DATA(和_url后):

form.click_request_data()

但可能需要作一些修改。

非常简单的例子:

br.select_form(name= form_name )
br.form[ login ]= login 
br.form[ pass ]= pass 
post_url, post_data, headers =  br.form.click_request_data()
mechanize.urlopen(post_url, post_data)




相关问题
Can Django models use MySQL functions?

Is there a way to force Django models to pass a field to a MySQL function every time the model data is read or loaded? To clarify what I mean in SQL, I want the Django model to produce something like ...

An enterprise scheduler for python (like quartz)

I am looking for an enterprise tasks scheduler for python, like quartz is for Java. Requirements: Persistent: if the process restarts or the machine restarts, then all the jobs must stay there and ...

How to remove unique, then duplicate dictionaries in a list?

Given the following list that contains some duplicate and some unique dictionaries, what is the best method to remove unique dictionaries first, then reduce the duplicate dictionaries to single ...

What is suggested seed value to use with random.seed()?

Simple enough question: I m using python random module to generate random integers. I want to know what is the suggested value to use with the random.seed() function? Currently I am letting this ...

How can I make the PyDev editor selectively ignore errors?

I m using PyDev under Eclipse to write some Jython code. I ve got numerous instances where I need to do something like this: import com.work.project.component.client.Interface.ISubInterface as ...

How do I profile `paster serve` s startup time?

Python s paster serve app.ini is taking longer than I would like to be ready for the first request. I know how to profile requests with middleware, but how do I profile the initialization time? I ...

Pragmatically adding give-aways/freebies to an online store

Our business currently has an online store and recently we ve been offering free specials to our customers. Right now, we simply display the special and give the buyer a notice stating we will add the ...

Converting Dictionary to List? [duplicate]

I m trying to convert a Python dictionary into a Python list, in order to perform some calculations. #My dictionary dict = {} dict[ Capital ]="London" dict[ Food ]="Fish&Chips" dict[ 2012 ]="...

热门标签