File tree Expand file tree Collapse file tree 1 file changed +4
-6
lines changed Expand file tree Collapse file tree 1 file changed +4
-6
lines changed Original file line number Diff line number Diff line change 19
19
20
20
from oauth2client .client import flow_from_clientsecrets
21
21
from oauth2client .client import GoogleCredentials
22
- from oauth2client .client import SignedJwtAssertionCredentials
22
+ from oauth2client .service_account import ServiceAccountCredentials
23
23
from googleapiclient .discovery import build
24
24
25
25
import packer
29
29
IMAGE_CACHE = {}
30
30
31
31
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
+
37
35
compute = build ('compute' , 'v1' , credentials = credentials )
38
36
images = compute .images ().list (project = project ).execute ()
39
37
items = images .get ('items' , [])
You can’t perform that action at this time.
0 commit comments