I'm using urllib.request with python 3.4.6 to open https://www.ethz.ch/ (The actual url is longer but the problem is the same), which opens fine with Firefox but throws a 404 error with python.
Here is the code
from urllib.request import urlopen
connection = urlopen('https://www.ethz.ch/')
and it gives the following error message
Traceback (most recent call last):
File "./generate_group_meetings_ical.py", line 9, in <module>
connection = urlopen('https://www.ethz.ch/')
File "/usr/lib64/python3.4/urllib/request.py", line 161, in urlopen
return opener.open(url, data, timeout)
File "/usr/lib64/python3.4/urllib/request.py", line 470, in open
response = meth(req, response)
File "/usr/lib64/python3.4/urllib/request.py", line 580, in http_response
'http', request, response, code, msg, hdrs)
File "/usr/lib64/python3.4/urllib/request.py", line 508, in error
return self._call_chain(*args)
File "/usr/lib64/python3.4/urllib/request.py", line 442, in _call_chain
result = func(*args)
File "/usr/lib64/python3.4/urllib/request.py", line 588, in http_error_default
raise HTTPError(req.full_url, code, msg, hdrs, fp)
urllib.error.HTTPError: HTTP Error 404: Not found UA
The code used to work fine though. Another piece of information is that I'm not root on the machine and python3 was upgraded from 3.4.5 to 3.4.6. So the comes either from the web server side or from the python side. I'm not a python nor a web expert so I couldn't figure it out myself.
Hope anybody can help me.