Bug 1278103 - Google update their api client. Needs to update the client draft
authorSylvestre Ledru <sledru@mozilla.com>
Mon, 13 Jun 2016 15:31:50 +0100
changeset 377881 dc6b1d9499a8a020686baaabdbd5dd1486568dad
parent 375481 b9213f375a3fa9570893c23eef9ef4be4cc83226
child 377882 690007c48c719ee3177ed9b03fb1d5f1635c24eb
push id20882
push usersledru@mozilla.com
push dateMon, 13 Jun 2016 14:33:01 +0000
bugs1278103
milestone49.0a1
Bug 1278103 - Google update their api client. Needs to update the client MozReview-Commit-ID: 5N76tXfLdPZ
testing/mozharness/mozharness/mozilla/googleplay.py
testing/mozharness/requirements.txt
--- a/testing/mozharness/mozharness/mozilla/googleplay.py
+++ b/testing/mozharness/mozharness/mozilla/googleplay.py
@@ -8,41 +8,33 @@
       5) Create "New client ID"
          or download the p12 key (it should remain
          super private)
       6) Move the file in this directory with the name
          'key.p12' or use the --credentials option
 """
 
 import httplib2
-
+from oauth2client.service_account import ServiceAccountCredentials
 from apiclient.discovery import build
 from oauth2client import client
 
 
 # GooglePlayMixin {{{1
 class GooglePlayMixin(object):
 
     def connect_to_play(self):
         """ Connect to the google play interface
         """
-        # Load the key in PKCS 12 format that you downloaded from the
-        # Google APIs Console when you created your Service account.
-        f = file(self.config["google_play_credentials_file"], 'rb')
-        key = f.read()
-        f.close()
 
         # Create an httplib2.Http object to handle our HTTP requests an
         # authorize it with the Credentials. Note that the first parameter,
         # service_account_name, is the Email address created for the Service
         # account. It must be the email address associated with the key that
         # was created.
         scope = 'https://www.googleapis.com/auth/androidpublisher'
-        credentials = client.SignedJwtAssertionCredentials(
-            self.config["service_account"],
-            key,
-            scope)
+        credentials = ServiceAccountCredentials.from_p12_keyfile(self.config["service_account"], self.config["google_play_credentials_file"], scopes=scope)
         http = httplib2.Http()
         http = credentials.authorize(http)
 
         service = build('androidpublisher', 'v2', http=http)
 
         return service
--- a/testing/mozharness/requirements.txt
+++ b/testing/mozharness/requirements.txt
@@ -16,10 +16,10 @@ paramiko==1.10.0
 pycrypto==2.6
 pyflakes==0.6.1
 pylint==0.27.0
 simplejson==2.1.1
 unittest2==0.5.1
 virtualenv==1.5.1
 wsgiref==0.1.2
 urllib3==1.9.1
-google-api-python-client==1.3.1
+google-api-python-client==1.5.1
 oauth2client==1.4.2