Skip to content

Commit 012492e

Browse files
committed
Update to latest version of oauth2client
1 parent 27ddf2c commit 012492e

File tree

1 file changed

+4
-6
lines changed

1 file changed

+4
-6
lines changed

case_studies/micromanage/service_google.py

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919

2020
from oauth2client.client import flow_from_clientsecrets
2121
from oauth2client.client import GoogleCredentials
22-
from oauth2client.client import SignedJwtAssertionCredentials
22+
from oauth2client.service_account import ServiceAccountCredentials
2323
from googleapiclient.discovery import build
2424

2525
import packer
@@ -29,11 +29,9 @@
2929
IMAGE_CACHE = {}
3030

3131
def google_get_images_json_key(project, key_json):
32-
credentials = SignedJwtAssertionCredentials(
33-
key_json['client_email'],
34-
key_json['private_key'],
35-
scope='https://www.googleapis.com/auth/compute')
36-
32+
credentials = ServiceAccountCredentials.from_json_keyfile_dict(
33+
key_json, scopes=['https://www.googleapis.com/auth/compute'])
34+
3735
compute = build('compute', 'v1', credentials=credentials)
3836
images = compute.images().list(project=project).execute()
3937
items = images.get('items', [])

0 commit comments

Comments
 (0)