How to POSTcall and retrieve result page

2008-01-10 Thread suyash jape
Hi all
i want to access a web page through python script, fillup the necessary
fields,
and press submit button (which does POST call) and retrieve the result page
and retrieve some values from it.

Here is the script i have written till now.

>import urllib2
> # create array of name/value pairs
> self.params = urllib.urlencode({'seqname': 'BioSequence', 'sequence':
'ATACATTATCCAAACATAGCATGGCTT'})
>
> # send http-post
> request = urllib.urlopen("http://www.hydrazome.metazome.net/search.php";,
params)
>
> # read back each line of reply
> line = request.read()
>print line

This script fills up the correct values in the search.php page.But i am not
sure if it is doing the POST (submit call).
Beacause in 'line' varialble, i am getting the search.php page.Not the
result page which is blast_results.php.

How to retrieve the result page?



Thanks
Suyash
-- 
http://mail.python.org/mailman/listinfo/python-list

How to POST call and retrieve result page

2008-01-11 Thread suyash jape
Hi all
i want to access a web page through python script, fillup the necessary
fields,
and press submit button (which does POST call) and retrieve the result page
and retrieve some values from it.

Here is the script i have written till now.

>import urllib2
> # create array of name/value pairs
> self.params = urllib.urlencode({'seqname': 'BioSequence', 'sequence':
'ATACATTATCCAAACATAGCATGGCTT'})
>
> # send http-post
> request = urllib.urlopen("http://www.hydrazome.metazome.net/search.php";,
params)
>
> # read back each line of reply
> line = request.read()
>print line

This script fills up the correct values in the search.php page.But i am not
sure if it is doing the POST (submit call).
Beacause in 'line' varialble, i am getting the search.php page.Not the
result page which is blast_results.php.

How to retrieve the result page?



Thanks
Suyash
-- 
http://mail.python.org/mailman/listinfo/python-list

Re: How to POST call and retrieve result page

2008-01-12 Thread suyash jape
Hi

/search.php fills the text box values. But /search.php has two form action
elements

1) 
AND
2) 

I  did GET and POST to both results.php  page , which gives *'String could
not be parsed as XML'*  exception.
Should data passed be in some XML format  or normal query ?

POST on blast_results.php also does not work.

I guess i am not able to identify the variable names to be
passed.For/search.php i found the
variables.But couldnt in the other forms.

Thanks for your help..
Suyash




On Jan 11, 2008 10:27 PM, Mike Meyer <[EMAIL PROTECTED]> wrote:

> On Fri, 11 Jan 2008 14:44:19 +0530 "suyash jape" <[EMAIL PROTECTED]>
> wrote:
>
> > Hi all
> > i want to access a web page through python script, fillup the necessary
> > fields,
> > and press submit button (which does POST call) and retrieve the result
> page
> > and retrieve some values from it.
> >
> > Here is the script i have written till now.
> >
> > >import urllib2
> > > # create array of name/value pairs
> > > self.params = urllib.urlencode({'seqname': 'BioSequence', 'sequence':
> > 'ATACATTATCCAAACATAGCATGGCTT'})
> > >
> > > # send http-post
> > > request = urllib.urlopen("http://www.hydrazome.metazome.net/search.php
> ",
> > params)
> > >
> > > # read back each line of reply
> > > line = request.read()
> > >print line
> >
> > This script fills up the correct values in the search.php page.But i am
> not
> > sure if it is doing the POST (submit call).
> > Beacause in 'line' varialble, i am getting the search.php page.Not the
> > result page which is blast_results.php.
> >
> > How to retrieve the result page?
>
> Sounds like you're not POSTing to the right page.
>
> The form on .../search.php lets you fill in values, but those values
> are not necessarily POSTed to search.php. In particular, the form element
> has an action attribute that has a URL to which the values on the page
> should be posted. If that points to .../blast_results.php, then that's
> the page you need to pass to urlopen with your data.
>
> --
> Mike Meyer < [EMAIL PROTECTED]>
> http://www.mired.org/consulting.html
> Independent Network/Unix/Perforce consultant, email for more information.
>
-- 
http://mail.python.org/mailman/listinfo/python-list