Access Database Using Python

2005-06-13 Thread Karthish
I'm writing a script to look through DNA sequences in a database and
select sequences I require. So far, my code looks like this for
authentication:

import os
import Bio.Clustalw
from Bio.Alphabet import IUPAC
import pdb
import sys
import os
import urllib
import urllib2


import urllib
userid = 'kmdawg'
password = 'kmdawgyeah'
location = 'index.html'
params = urllib.urlencode({'user': userid, 'password': password,
'request_uri': location})
f = urllib2.urlopen("http://www.gene-regulation.com/login?%s"; % params)
print f.read()

When I run the program, I see the following:
__



  Redirect
  
  
  
  
Please stand by, you will be redirected
toindex.html...


The code works as it is. How would I modify this script to display the
page
"http://www.gene-regulation.com/cgi-bin/pub/databases/transfac/getTF.cgi?AC=R00077";?
I can't figure out how to authenticate and then load a page, since the
page requires cookies for authentication. 

Thanks.

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


Access Database Using Python

2005-06-13 Thread Karthish

I'm writing a script to look through DNA sequences in a database and
select sequences I require. So far, my code looks like this for
authentication:

import os
import Bio.Clustalw
from Bio.Alphabet import IUPAC
import pdb
import sys
import os
import urllib
import urllib2

import urllib
userid = 'something'
password = 'something2'
location = 'index.html'
params = urllib.urlencode({'user': userid, 'password': password,
'request_uri': location})
f = urllib2.urlopen("http://www.gene-regulation.com/login?%s"; % params)
print f.read()

When I run the program, I see the following:
__



  Redirect
  
  
  
  
Please stand by, you will be redirected
toindex.html...


The code works as it is. How would I modify this script to display the
page
"http://www.gene-regulation.com/cgi-bin/pub/databases/transfac/getTF.cgi?AC=R00077";?
I can't figure out how to authenticate and then load a page, since the
page requires cookies for authentication.

Thanks.

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