da ich nicht besonders Lust habe stundenlang im dunklen zu tappen mal folgende Frage:
Code: Alles auswählen
#!/usr/bin/env python
# -*- coding: UTF8 -*-
# connect2ln 0.01
# Author: Maël Mettler
# Home: www.mediamonger.ch
# e-mail: ln2xml@mediamonger.ch
# License: GNU v2
import urllib2
import cookielib
the_url = 'http://www.lexisnexis.com/de/business/search/loadForm.do'
user_agent = 'Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.7.8) Gecko/20050514 Firefox/1.0.4'
headers = { 'User-Agent' : user_agent,
"Accept" : "text/xml,application/xml,application/xhtml+xml,text/html;q=0.9,text/plain;q=0.8,image/png,*/*;q=0.5",
"Accept-Language" : "en-us,en;q=0.5",
#"Accept-Encoding" : "gzip,deflate",
"Accept-Charset" : "ISO-8859-1,utf-8;q=0.7,*;q=0.7",
"Keep-Alive" : "300",
"Proxy-Connection" : "keep-alive",
"Proxy-Authorization" : "Basic czAxNzEyMTg6Kk5hcnV0MA=="}
# Create an OpenerDirector with support for Basic HTTP Authentication...
auth_handler = urllib2.ProxyBasicAuthHandler()
auth_handler.add_password('unizh.ch', 'proxy.unizh.ch:3128', name, pass)
opener = urllib2.build_opener(auth_handler)
#
cj = cookielib.CookieJar()
opener2 = urllib2.build_opener(urllib2.HTTPCookieProcessor(cj))
# ...and install it globally so it can be used with urlopen.
urllib2.install_opener(opener)
urllib2.install_opener(opener2)
req = urllib2.Request(the_url, None, headers)
side = urllib2.urlopen(req)
html = side.read()
file = open("result.htm", "w")
file.write(html)
file.close()