[Tutor] Accessing query results html frame
Karim
karim.liateni at free.fr
Thu Feb 10 19:12:48 CET 2011
Hello All,
I get from Steven an very useful link (void space) for http
authentication. I added some codes to be
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.
The problem is I get a html page which refers 2 frames. And I am
interesting in one particular frame
namely for example,
http://{server}:{port}/wt/tmp/results:karim.liateni.31_3917.html'.format(server=server, port=port).
But this pages is created every times in a tmp directory each time with
a different name.
1) How can I get the name of this page because with python the page
resulting of my query is not mentionned (hidden like)?
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.
Is there a method to get all the nested frames locations?
2) I can see this page interactively when I click on a submit query
button. Do I need to add 'ACTION': "Query" <input form
in the query dictionnary to simulate a click for submission
(type="submit" button) ?
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
same value in my python code. Is this ok?
import urllib
import urllib2
server='dummy.com'
port='8081'
username = 'karim.liateni'
password = 'dummy_pass'
theurl = 'http://{server}:{port}/ddts/ddts_main'.format(server=server,
port=port)
#theurl =
'http://{server}:{port}:8081/wt/tmp/results:karim.liateni.31_3917.html'.format(server=server,
port=port)
#MEMO:
#<FORM METHOD="POST" ACTION="/ddts/ddts_main"
ENCTYPE="application/x-www-form-urlencoded" TARGET="rightframe">
data = {
'NextForm': "",
'LastForm': "SavedQuery",
'prompted': "yes",
'class': "Development",
'personalQuery': "DKPV",
'REMOTE_USER': username,
'QS': " -p DKPVALIDATION_PLUGIN \(Class 'isequal'
"Development" \)",
'use_field_defs':"false",
'QueryName': "DKPV",
'QueryType': "personal",
'ACTION': "Query"
}
query = urllib.urlencode(data)
request = urllib2.Request(theurl, query)
passman = urllib2.HTTPPasswordMgrWithDefaultRealm()
passman.add_password(None, theurl, username, password)
authhandler = urllib2.HTTPBasicAuthHandler(passman)
opener = urllib2.build_opener(authhandler)
urllib2.install_opener(opener)
pagehandle = urllib2.urlopen(request)
print(pagehandle.read())
More information about the Tutor
mailing list