diff options
author | Daniel G. Taylor <dan@programmer-art.org> | 2014-08-01 14:33:47 -0700 |
---|---|---|
committer | Daniel G. Taylor <dan@programmer-art.org> | 2014-08-01 14:33:47 -0700 |
commit | 6ff525e9e5aef8c24da2a79a7e6fe428b7a7edbc (patch) | |
tree | 2765791697d27935db302ea731afed75b505897d /boto | |
parent | 494a0916a858cdb065eee5fbd4be70bf5f95cbc8 (diff) | |
parent | ca9b3de5bc2f69ff6e54a185bec0f1443565fd00 (diff) | |
download | boto-6ff525e9e5aef8c24da2a79a7e6fe428b7a7edbc.tar.gz |
Merge pull request #2486 from piotrbulinski/LazyLoadMetadata_py3
Fix TypeError when getting instance metadata under Python 3. Fixes #2485.
Diffstat (limited to 'boto')
-rw-r--r-- | boto/utils.py | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/boto/utils.py b/boto/utils.py index 4fbce49c..dd5f0956 100644 --- a/boto/utils.py +++ b/boto/utils.py @@ -213,6 +213,11 @@ def retry_url(url, retry_on_404=True, num_retries=10): req = urllib.request.Request(url) r = opener.open(req) result = r.read() + + if(not isinstance(result, six.string_types) and + hasattr(result, 'decode')): + result = result.decode('utf-8') + return result except urllib.error.HTTPError as e: code = e.getcode() |