From a88871b6a64b91b88dbb75d91b8ba679349a977b Mon Sep 17 00:00:00 2001 From: puhitaku Date: Tue, 8 Dec 2015 18:57:27 +0900 Subject: [PATCH 1/2] Fix loading json for Python3 --- bigquery/client.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/bigquery/client.py b/bigquery/client.py index d550c4a..860b887 100644 --- a/bigquery/client.py +++ b/bigquery/client.py @@ -82,8 +82,8 @@ def get_client(project_id, credentials=None, service_account=None, private_key = key_file.read() if json_key_file: - with open(json_key_file, 'rb') as key_file: - json_key = json.loads(key_file.read()) + with open(json_key_file, 'r') as key_file: + json_key = json.load(key_file) if json_key: service_account = json_key['client_email'] From 198d35fc2bc967e3eaa642c8621e3ba8c4fe657c Mon Sep 17 00:00:00 2001 From: puhitaku Date: Tue, 8 Dec 2015 20:37:15 +0900 Subject: [PATCH 2/2] Change assert command for change --- bigquery/tests/test_client.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bigquery/tests/test_client.py b/bigquery/tests/test_client.py index 469e44c..d8869ee 100644 --- a/bigquery/tests/test_client.py +++ b/bigquery/tests/test_client.py @@ -158,7 +158,7 @@ def test_initialize_json_key_file(self, mock_open, mock_build, mock_return_cred) bq_client = client.get_client(project_id, json_key_file=json_key_file, readonly=False) - mock_open.assert_called_once_with(json_key_file, 'rb') + mock_open.assert_called_once_with(json_key_file, 'r') mock_return_cred.assert_called_once_with() mock_cred.assert_called_once_with(json_key['client_email'], json_key['private_key'], scope=BIGQUERY_SCOPE) self.assertTrue(mock_cred.return_value.authorize.called)