From 905734f6d23bd49833dff40f89f62b366425232b Mon Sep 17 00:00:00 2001 From: Jason Scaroni Date: Wed, 8 Apr 2020 18:45:37 -0400 Subject: [PATCH] Changed the update requests to replace the standard Python user-agent header with Mozilla. --- manuf/manuf.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/manuf/manuf.py b/manuf/manuf.py index 33926bb..33295f7 100755 --- a/manuf/manuf.py +++ b/manuf/manuf.py @@ -25,9 +25,11 @@ import io try: + from urllib2 import Request from urllib2 import urlopen from urllib2 import URLError except ImportError: + from urllib.request import Request from urllib.request import urlopen from urllib.error import URLError @@ -139,7 +141,7 @@ def update(self, manuf_url=None, wfa_url=None, manuf_name=None, refresh=True): # Retrieve the new database try: - response = urlopen(manuf_url) + response = urlopen(Request(manuf_url, headers={'User-Agent': 'Mozilla'})) except URLError: raise URLError("Failed downloading OUI database") @@ -159,7 +161,7 @@ def update(self, manuf_url=None, wfa_url=None, manuf_name=None, refresh=True): # Append WFA to new database try: - response = urlopen(wfa_url) + response = urlopen(Request(wfa_url, headers={'User-Agent': 'Mozilla'})) except URLError: raise URLError("Failed downloading WFA database")