<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta content="text/html; charset=ISO-8859-1"
http-equiv="Content-Type">
</head>
<body bgcolor="#ffffff" text="#000000">
<br>
Hello,<br>
<br>
As I get no response from the tutor python list, I am continuing to
investigate my problem.<br>
<br>
In fact the issue is that there are 2 forms in the interactive page
and my request does nothing<br>
instead I get the interactive page not the submission I asked (query
results). The 2 forms are:<br>
<br>
<ol>
<li><FORM METHOD="POST" ACTION="/ddts/ddts_main"
ENCTYPE="application/x-www-form-urlencoded" NAME="form1"></li>
<li><FORM METHOD="POST" ACTION="/ddts/ddts_main"
ENCTYPE="application/x-www-form-urlencoded" NAME="form9"></li>
</ol>
And the parameters for each are:<br>
<br>
1)<br>
<INPUT TYPE="hidden" NAME="init" VALUE=""><br>
<INPUT TYPE="hidden" NAME="LastForm" VALUE="SavedQuery"><br>
<INPUT TYPE="hidden" NAME="NextForm" VALUE=""><br>
<INPUT TYPE="hidden" NAME="REMOTE_USER" VALUE="karim.liateni"><br>
<INPUT TYPE="submit" NAME="ACTION" VALUE="Query"> <br>
<INPUT TYPE="submit" NAME="ACTION" VALUE="Report"> <br>
<INPUT TYPE="submit" NAME="ACTION" VALUE="Edit"> <br>
<INPUT TYPE="submit" NAME="ACTION" VALUE="Delete"> <br>
<INPUT TYPE="submit" NAME="ACTION" VALUE="Create"
ONCLICK="oncreate()"> <br>
<INPUT TYPE="submit" NAME="ACTION" VALUE="Create String
Query"><br>
<INPUT TYPE="hidden" NAME=".cgifields" VALUE="personalQuery"><br>
<INPUT TYPE="hidden" NAME=".cgifields" VALUE="sharedQuery"><br>
<br>
2)<br>
<INPUT TYPE="hidden" NAME="LastForm" VALUE="DumpBug"><br>
<INPUT TYPE="hidden" NAME="REMOTE_USER" VALUE="karim.liateni"><br>
<INPUT TYPE="text" NAME="bug_id" VALUE="" SIZE=10
MAXLENGTH=10><br>
<INPUT TYPE="submit" NAME=".submit" VALUE="View"><br>
<br>
And I recall my data of the progam below:<br>
<br>
data = { <br>
'init' : "",<br>
'LastForm': "SavedQuery", <br>
'prompted': "yes", <br>
'class': "Development", <br>
'personalQuery': "DKPV", <br>
'REMOTE_USER': username, <br>
'QS': " -p DKPVALIDATION_PLUGIN \(Class 'isequal'
"Development" \)", <br>
'use_field_defs':"false", <br>
'QueryName': "DKPV", <br>
'QueryType': "personal", <br>
'ACTION': "Query" <br>
} <br>
<br>
So the question is how could I specify the correct FORM submission
and how could I chose the correct action because<br>
there are several TYPE='submit' and I am only interested by this one
VALUE="Query"?<br>
<br>
Regards<br>
Karim<br>
<br>
On 02/11/2011 08:51 AM, Karim wrote:
<blockquote cite="mid:4D54EA92.4030800@free.fr" type="cite"> <br>
Hello, <br>
<br>
In fact as found in the net: <br>
<br>
"The concept of browser frames is completely outside the scope of
HTTP. However, browser frames are defined in HTML, and so is the
target property on form elements: <form
action="/somescript?x=y" method="POST" target="_top"> This
will make the form submit to the _top frame, which means "use the
full browser window" " <br>
<br>
That means that my post form: <br>
<br>
<FORM METHOD="POST" ACTION="/ddts/ddts_main"
ENCTYPE="application/x-www-form-urlencoded"
TARGET="rightframe"> <br>
<br>
has a target property to make the submit to the 'rightframe'. <br>
<br>
Any ideas how I can modified the code (I think the request data or
whatever) below to access without knowing the temporary html file
name generically. <br>
<br>
Regards <br>
Karim <br>
<br>
On 02/10/2011 07:12 PM, Karim wrote: <br>
<blockquote type="cite"> <br>
Hello All, <br>
<br>
I get from Steven an very useful link (void space) for http
authentication. I added some codes to be <br>
able to POST FORM a query as I do it by clicking a query button
to get a list of bug Id on a server. <br>
The problem is I get a html page which refers 2 frames. And I am
interesting in one particular frame <br>
namely for example, <br>
<a class="moz-txt-link-freetext" href="http://">http://</a>{server}:{port}/wt/tmp/results:karim.liateni.31_3917.html'.format(server=server,
port=port). <br>
But this pages is created every times in a tmp directory each
time with a different name. <br>
<br>
1) How can I get the name of this page because with python the
page resulting of my query is not mentionned (hidden like)? <br>
Interactively there are 3 frames but only this one is of
interest for me. But no name of this page is visible in the main
html page. <br>
Is there a method to get all the nested frames locations? <br>
<br>
2) I can see this page interactively when I click on a submit
query button. Do I need to add 'ACTION': "Query" <input form
<br>
in the query dictionnary to simulate a click for submission
(type="submit" button) ? <br>
<br>
3) Interactively I see that cgi arg NextForm is empty so I let
it like that in my query and LastForm was set to "SavedQuery". I
put the <br>
same value in my python code. Is this ok? <br>
<br>
import urllib <br>
import urllib2 <br>
<br>
server='dummy.com' <br>
port='8081' <br>
<br>
username = 'karim.liateni' <br>
password = 'dummy_pass' <br>
<br>
theurl = '<a class="moz-txt-link-freetext" href="http://">http://</a>{server}:{port}/ddts/ddts_main'.format(server=server,
port=port) <br>
#theurl = '<a class="moz-txt-link-freetext" href="http://">http://</a>{server}:{port}:8081/wt/tmp/results:karim.liateni.31_3917.html'.format(server=server,
port=port) <br>
<br>
#MEMO: <br>
#<FORM METHOD="POST" ACTION="/ddts/ddts_main"
ENCTYPE="application/x-www-form-urlencoded"
TARGET="rightframe"> <br>
<br>
data = { <br>
'NextForm': "", <br>
'LastForm': "SavedQuery", <br>
'prompted': "yes", <br>
'class': "Development", <br>
'personalQuery': "DKPV", <br>
'REMOTE_USER': username, <br>
'QS': " -p DKPVALIDATION_PLUGIN \(Class 'isequal'
"Development" \)", <br>
'use_field_defs':"false", <br>
'QueryName': "DKPV", <br>
'QueryType': "personal", <br>
'ACTION': "Query" <br>
} <br>
<br>
query = urllib.urlencode(data) <br>
request = urllib2.Request(theurl, query) <br>
<br>
passman = urllib2.HTTPPasswordMgrWithDefaultRealm() <br>
passman.add_password(None, theurl, username, password) <br>
authhandler = urllib2.HTTPBasicAuthHandler(passman) <br>
<br>
opener = urllib2.build_opener(authhandler) <br>
urllib2.install_opener(opener) <br>
<br>
pagehandle = urllib2.urlopen(request) <br>
print(pagehandle.read()) <br>
_______________________________________________ <br>
Tutor maillist - <a class="moz-txt-link-abbreviated"
href="mailto:Tutor@python.org">Tutor@python.org</a> <br>
To unsubscribe or change subscription options: <br>
<a class="moz-txt-link-freetext"
href="http://mail.python.org/mailman/listinfo/tutor">http://mail.python.org/mailman/listinfo/tutor</a>
<br>
</blockquote>
<br>
_______________________________________________ <br>
Tutor maillist - <a class="moz-txt-link-abbreviated"
href="mailto:Tutor@python.org">Tutor@python.org</a> <br>
To unsubscribe or change subscription options: <br>
<a class="moz-txt-link-freetext"
href="http://mail.python.org/mailman/listinfo/tutor">http://mail.python.org/mailman/listinfo/tutor</a>
<br>
</blockquote>
<br>
<br>
</body>
</html>