So I'm trying to use Python to automate the 508 compliance check. There are a few hundred pages on our site, and at this time a person is actually going to the site every week and tries to enter all the URLs by hand. Below, the UIUC checks the request for the link referrer header and then returns the site's evaluation back. I can not really get a request to work, I have seen everyone through SO and whatever helps, can not get it. This code is bad, below and below the error message. Def fae (urltofae): opener = urllib2.build_opener () opener.addheaders = [('user-agent', 'mozilla / 5.0']] # [('Referrer': urltofae )] R = Opener. Open ('http://www.fae.cita.uiuc.edu/evaluate/link/') Print RFE ("http://www.example.com/")
More Error:
File "", line 1, & lt; Module & gt; File "File: Library / Framework / Python.framework / Versions 7.3 / lib / python2.7 / urllib2.py", line 400, open response = self._open, in the file "& lt; stdin & gt; (File "/ Library / Framework / Python" / Library / Framework / Filename Framework / Version 7/3 / lib / python2.7 / urllib2.py ", line 418, _open '_open', in req) File Framework / Version / 7.3 / lib / python2.7 / urllib2.py ", line 378, _call_chain result =" / library / framework / Python.framework / versions / 7.3 / lib / python2.7 / Urlib2 in the result = func (* args) file. Py ", line 1207, http_open UrlRR (error) urllib2 in self.do_open (httplib.HTTPConnection, req) file "/ library / framework / Python.framework / version 7,3 / lib / python2.7 / urllib2.py", line 1177 in Do_open raise, .URLError: & lt; Urlopen error [error 8] Node name and pronoun has not been provided, or is not known & gt; And when I try to change the referrer header (instead of the user-agent), instead I get the formatting of errors instead of receiving the request, although the format is the same It is that he did not complain about user-agent.
I am still a new programmer, so if I am missing something redundant then I am very sorry, but I can think of everything I can. Thanks in advance, cheers.
OK, so I changed my strategy and it worked. Unfortunately, I do not know why the code given below was not worked out, and the above mentioned stuff kept me giving an error, but I have seen the same similar question (no specific answer) around Google, so I thought I should post it.
VLG, appreciate the help, Cheers.
DFFAEEx2 (URLTFAA): R = URLB2. Request ('http://fae.cita.illinois.edu/evaluate/link/', header = {'user-agent': 'Mozilla / 5.0', 'referrer': urltofae}) c = urllib2.urlopen (r ) Print c.read ()
I see no mistake there URL is correct?
instead of 'http://fae.cita.uiuc.edu/evaluate/link/' < / P>
Try using 'http://www.fae.cita.uiuc.edu/evaluate/link/' Anywhere later Does not carry.
No comments:
Post a Comment