Skip to content

Commit

Permalink
Remove oauth2client from IoT and Functions samples (#3255)
Browse files Browse the repository at this point in the history
* chore: remove oauth2client from functions and iot

* fix: fix import

* fix: correct syntax

* fix: correct import for service_account

* fix: fix path
  • Loading branch information
busunkim96 authored Apr 3, 2020
1 parent ba4d402 commit 89840a0
Show file tree
Hide file tree
Showing 6 changed files with 4 additions and 12 deletions.
6 changes: 1 addition & 5 deletions functions/billing/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@
# [START functions_billing_limit_appengine]
# [START functions_billing_stop]
from googleapiclient import discovery
from oauth2client.client import GoogleCredentials
# [END functions_billing_stop]
# [END functions_billing_limit]
# [END functions_billing_limit_appengine]
Expand Down Expand Up @@ -80,7 +79,6 @@ def stop_billing(data, context):
'cloudbilling',
'v1',
cache_discovery=False,
credentials=GoogleCredentials.get_application_default()
)

projects = billing.projects()
Expand Down Expand Up @@ -130,7 +128,6 @@ def limit_use(data, context):
'compute',
'v1',
cache_discovery=False,
credentials=GoogleCredentials.get_application_default()
)
instances = compute.instances()

Expand Down Expand Up @@ -190,8 +187,7 @@ def limit_use_appengine(data, context):
appengine = discovery.build(
'appengine',
'v1',
cache_discovery=False,
credentials=GoogleCredentials.get_application_default()
cache_discovery=False
)
apps = appengine.apps()

Expand Down
1 change: 0 additions & 1 deletion functions/billing/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
slackclient==2.5.0
# [START functions_billing_limit_appengine_deps]
oauth2client==4.1.3
google-api-python-client==1.7.11
# [START functions_billing_limit_appengine_deps]
1 change: 0 additions & 1 deletion functions/slack/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
google-api-python-client==1.7.11
flask==1.1.1
oauth2client==4.1.3
slackeventsapi==2.1.0
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@
from google.cloud import pubsub
from googleapiclient import discovery
from googleapiclient.errors import HttpError
from oauth2client.service_account import ServiceAccountCredentials
from google.oauth2 import service_account


API_SCOPES = ['https://www.googleapis.com/auth/cloud-platform']
Expand All @@ -58,8 +58,8 @@ class Server(object):
"""Represents the state of the server."""

def __init__(self, service_account_json):
credentials = ServiceAccountCredentials.from_json_keyfile_name(
service_account_json, API_SCOPES)
credentials = service_account.Credentials.from_service_account_file(
service_account_json).with_scopes(API_SCOPES)
if not credentials:
sys.exit('Could not load service account credential '
'from {}'.format(service_account_json))
Expand Down
1 change: 0 additions & 1 deletion iot/api-client/end_to_end_example/requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,5 @@ google-api-python-client==1.7.11
google-auth-httplib2==0.0.3
google-auth==1.11.2
google-cloud-pubsub==1.1.0
oauth2client==4.1.3
pyjwt==1.7.1
paho-mqtt==1.5.0
1 change: 0 additions & 1 deletion iot/api-client/manager/requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,5 @@ google-auth-httplib2==0.0.3
google-auth==1.11.2
google-cloud-iot==1.0.0
google-cloud-pubsub==1.1.0
oauth2client==4.1.3
paho-mqtt==1.5.0
pyjwt==1.7.1

0 comments on commit 89840a0

Please sign in to comment.