Skip to content

Commit

Permalink
Using json_credentials_path in get_for_service_account_json.
Browse files Browse the repository at this point in the history
Was private_key_path.
  • Loading branch information
dhermes committed Feb 15, 2015
1 parent 66b47b5 commit a80f1dd
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 8 deletions.
15 changes: 9 additions & 6 deletions gcloud/credentials.py
Original file line number Diff line number Diff line change
Expand Up @@ -73,13 +73,16 @@ def get_credentials():
return client.GoogleCredentials.get_application_default()


def get_for_service_account_json(private_key_path, scope=None):
def get_for_service_account_json(json_credentials_path, scope=None):
"""Gets the credentials for a service account with JSON key.
:type private_key_path: string
:param private_key_path: The path to a private key file (this file was
given to you when you created the service
account). This file must be in JSON key format.
:type json_credentials_path: string
:param json_credentials_path: The path to a private key file (this file was
given to you when you created the service
account). This file must contain a JSON
object with a private key and other
credentials information (downloaded from the
Google APIs console).
:type scope: string or tuple of string
:param scope: The scope against which to authenticate. (Different services
Expand All @@ -93,7 +96,7 @@ def get_for_service_account_json(private_key_path, scope=None):
credentials object.
"""
credentials = _get_application_default_credential_from_file(
private_key_path)
json_credentials_path)
if scope is not None:
credentials = credentials.create_scoped(scope)
return credentials
Expand Down
4 changes: 2 additions & 2 deletions gcloud/test_credentials.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,9 +63,9 @@ def test_get_for_service_account_p12_w_scope(self):

class Test_get_for_service_account_json(unittest2.TestCase):

def _callFUT(self, private_key_path, scope=None):
def _callFUT(self, json_credentials_path, scope=None):
from gcloud.credentials import get_for_service_account_json
return get_for_service_account_json(private_key_path, scope=scope)
return get_for_service_account_json(json_credentials_path, scope=scope)

def test_it(self):
from gcloud._testing import _Monkey
Expand Down

0 comments on commit a80f1dd

Please sign in to comment.