4444
4545from googleapiclient import discovery
4646from googleapiclient import errors
47- import httplib2
48- from oauth2client .client import GoogleCredentials
4947
5048BATCH_SIZE = 10
5149
@@ -54,8 +52,7 @@ class VisionApi(object):
5452 """Construct and use the Cloud Vision API service."""
5553
5654 def __init__ (self ):
57- credentials = GoogleCredentials .get_application_default ()
58- self .service = discovery .build ('vision' , 'v1' , credentials = credentials )
55+ self .service = discovery .build ('vision' , 'v1' )
5956
6057 def detect_text (self , input_filenames , num_retries = 3 , max_results = 6 ):
6158 """Uses the Vision API to detect text in the given file."""
@@ -113,14 +110,7 @@ class TextAnalyzer(object):
113110 """Construct and use the Google Natural Language API service."""
114111
115112 def __init__ (self , db_filename = None ):
116- credentials = GoogleCredentials .get_application_default ()
117- scoped_credentials = credentials .create_scoped (
118- ['https://www.googleapis.com/auth/cloud-platform' ])
119- http = httplib2 .Http ()
120- scoped_credentials .authorize (http )
121- self .service = discovery .build ('language' , 'v1' ,
122- http = http ,
123- credentials = credentials )
113+ self .service = discovery .build ('language' , 'v1' )
124114
125115 # This list will store the entity information gleaned from the
126116 # image files.
0 commit comments