diff options
author | Ed Bartosh <ed.bartosh@linux.intel.com> | 2016-06-02 13:12:50 +0300 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2016-06-02 11:46:15 +0100 |
commit | ec3f1759e8b491a44a1fc1ecb6f89919dd30da97 (patch) | |
tree | 217273e893b3f561333c51e629ce562828cc5328 /scripts/send-error-report | |
parent | 438eabc248f272e3d272aecaa4c9cec177b172d5 (diff) | |
download | openembedded-core-ec3f1759e8b491a44a1fc1ecb6f89919dd30da97.tar.gz openembedded-core-ec3f1759e8b491a44a1fc1ecb6f89919dd30da97.tar.bz2 openembedded-core-ec3f1759e8b491a44a1fc1ecb6f89919dd30da97.zip |
scripts: python3: fix urllib imports
Some functions and classes have been moved from urllib[2]
to urllib.request and urllib.error in python 3.
Used new imports to make the code working in python 3.
Signed-off-by: Ed Bartosh <ed.bartosh@linux.intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'scripts/send-error-report')
-rwxr-xr-x | scripts/send-error-report | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/scripts/send-error-report b/scripts/send-error-report index ed78bd6ebb..a9f6e42d17 100755 --- a/scripts/send-error-report +++ b/scripts/send-error-report @@ -7,7 +7,7 @@ # Author: Andreea Proca <andreea.b.proca@intel.com> # Author: Michael Wood <michael.g.wood@intel.com> -import urllib2 +import urllib.request, urllib.error import sys import json import os @@ -25,10 +25,10 @@ log = logging.getLogger("send-error-report") logging.basicConfig(format='%(levelname)s: %(message)s') def getPayloadLimit(url): - req = urllib2.Request(url, None) + req = urllib.request.Request(url, None) try: - response = urllib2.urlopen(req) - except urllib2.URLError as e: + response = urllib.request.urlopen(req) + except urllib.error.URLError as e: # Use this opportunity to bail out if we can't even contact the server log.error("Could not contact server: " + url) log.error(e.reason) @@ -136,10 +136,10 @@ def send_data(data, args): else: url = "http://"+args.server+"/ClientPost/" - req = urllib2.Request(url, data=data, headers=headers) + req = urllib.request.Request(url, data=data, headers=headers) try: - response = urllib2.urlopen(req) - except urllib2.HTTPError, e: + response = urllib.request.urlopen(req) + except urllib.error.HTTPError as e: logging.error(e.reason) sys.exit(1) |