This is the solution I found:
import mechanize,urllib,ClientForm,cookielib,re,os,time
from BeautifulSoup import BeautifulSoup
cookies = mechanize.CookieJar()
opener = mechanize.build_opener(mechanize.HTTPCookieProcessor(cookies))
headers = [("Accept","text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8"),\
("Accept-Charset","ISO-8859-1,utf-8;q=0.7,*;q=0.7"),\
("Accept-Encoding","gzip, deflate"),\
("Accept-Language","en-us,en;q=0.5"),\
("Connection","keep-alive"),\
("Host","www.aladin.wrlc.org"),\
("Referer","https://www.aladin.wrlc.org/Z-WEB/Aladin?req=db&key=PROXYAUTHlib=8url=http://eebo.chadwyck.com/search"),\
("User-Agent","Mozilla/5.0 (Macintosh; Intel Mac OS X 10.6; rv:5.0) Gecko/20100101 Firefox/5.0")]
opener.addheaders = headers
mechanize.install_opener(opener)
params = urllib.urlencode({'LN':'myLN','BC':'myBC','INST':'myINST',\
'req':'db','key':'PROXYAUTH','lib':'8',\
'url':'http://eebo.chadwyck.com/search'})
mechanize.urlopen("https://www.aladin.wrlc.org/Z-WEB/PATLogon",params)
Hope this ever helps someone :)
source
share