x86-info-term icon indicating copy to clipboard operation
x86-info-term copied to clipboard

Set a generic user agent for Intel Intrinsic Guide data

Open Terminus-IMRC opened this issue 2 years ago • 0 comments

First of all, thank you very much for developing this utility!

The Intel site recently started to silently refuse the urllib user agent, and the xml file download will never been finished:

>>> import urllib.request
>>> url = 'https://software.intel.com/content/dam/develop/public/us/en/include/intrinsics-guide/data-latest.xml'
>>> urllib.request.urlopen(url, timeout=5).reason
Traceback (most recent call last):
...
socket.timeout: The read operation timed out

This pull request sets a generic user agent (Mozilla/5.0) as a workaround:

>>> req = urllib.request.Request(url, headers={'User-Agent': 'Mozilla/5.0'})
>>> urllib.request.urlopen(req, timeout=5).reason
OK

Terminus-IMRC avatar Oct 23 '22 11:10 Terminus-IMRC