From a0fb3c8f50c13cb7207f04a3107cea4dc88e0581 Mon Sep 17 00:00:00 2001
From: Adar Nimrod <nimrod@shore.co.il>
Date: Wed, 23 May 2018 16:30:34 +0300
Subject: [PATCH] Corrected deduction of AWS region.

---
 .bashrc | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/.bashrc b/.bashrc
index 8af1def..37f36a0 100644
--- a/.bashrc
+++ b/.bashrc
@@ -194,7 +194,8 @@ deduce_aws_region () {
     AWS_DEFAULT_REGION="$(python3 << EOF
 from urllib.request import urlopen
 import json
-print(json.load(urlopen('http://169.254.169.254/latest/dynamic/instance-identity/document'))['region'])
+response = urlopen('http://169.254.169.254/latest/dynamic/instance-identity/document')
+print(json.loads(response.read().decode('utf-8'))['region'])
 EOF
     )"
     export AWS_DEFAULT_REGION
-- 
GitLab