def __init__(self, username, password=None):
# Get password if necessary
if password is None:
password = getpass()
# Get URL for the database
self.db_url = "http://galaxy-catalogue.dur.ac.uk:8080/Eagle"
# Set up authentication and cookies
self.password_mgr = urllib2.HTTPPasswordMgrWithDefaultRealm()
self.password_mgr.add_password(None, self.db_url, username, password)
self.opener = urllib2.OpenerDirector()
self.auth_handler = urllib2.HTTPBasicAuthHandler(self.password_mgr)
self.cookie_handler = urllib2.HTTPCookieProcessor(cookie_jar)
## This functions executes an SQL query on the database and returns the result as a record array.
评论列表
文章目录