title: WARNING:oauth2client.util:build() takes at most 2 positional arguments (3 given)
body: <p>I am doing the "Label Detection" tutorial for the Google Cloud Vision API.<br>
  When I pass an image to the command like so I expect to get back some json telling me what is in the image.</p>
  
  <p>However, I am getting this error instead.</p>
  
  <pre><code>    &gt;python label_request.py faulkner.jpg 
  No handlers could be found for logger "oauth2client.util"
  WARNING:root:No module named locked_file
  Traceback (most recent call last):
    File "/usr/local/lib/python2.7/site-packages/googleapiclient/discovery_cache/__init__.py", line 38, in autodetect
      from . import file_cache
    File "/usr/local/lib/python2.7/site-packages/googleapiclient/discovery_cache/file_cache.py", line 32, in &lt;module&gt;
      from oauth2client.locked_file import LockedFile
  ImportError: No module named locked_file
  Traceback (most recent call last):
    File "label_request.py", line 44, in &lt;module&gt;
      main(args.image_file)
    File "label_request.py", line 18, in main
      service = build('vision', 'v1', http, discoveryServiceUrl=API_DISCOVERY_FILE)
    File "/usr/local/lib/python2.7/site-packages/oauth2client/util.py", line 140, in positional_wrapper
      return wrapped(*args, **kwargs)
    File "/usr/local/lib/python2.7/site-packages/googleapiclient/discovery.py", line 202, in build
      raise e
  googleapiclient.errors.HttpError: &lt;HttpError 403 when requesting https://vision.googleapis.com/$discovery/rest?version=v1 returned "Project has not activated the vision.googleapis.com API. Please enable the API for project google.com:cloudsdktool (#32555940559)."&gt;
  </code></pre>
  
  <p>Lots going on here.<br>
  But the Project API <em>is</em> enabled.<br>
  So this is part of the error message is erroneous.</p>
  
  <p>It seems that "there was a change in the newest version of the oauth2client, v2.0.0, which broke compatibility with the google-api-python-client module".<br>
  <a href="https://stackoverflow.com/a/35492604/2341218">https://stackoverflow.com/a/35492604/2341218</a>  </p>
  
  <p>I applied this fix ...</p>
  
  <pre><code>pip install --upgrade git+https://github.com/google/google-api-python-client
  </code></pre>
  
  <p>After applying this fix, I get fewer errors ...</p>
  
  <pre><code>    &gt;python label_request.py faulkner.jpg 
  No handlers could be found for logger "oauth2client.util"
  Traceback (most recent call last):
    File "label_request.py", line 44, in &lt;module&gt;
      main(args.image_file)
    File "label_request.py", line 18, in main
      service = build('vision', 'v1', http, discoveryServiceUrl=API_DISCOVERY_FILE)
    File "/usr/local/lib/python2.7/site-packages/oauth2client/util.py", line 137, in positional_wrapper
      return wrapped(*args, **kwargs)
    File "/usr/local/lib/python2.7/site-packages/googleapiclient/discovery.py", line 209, in build
      raise e
  googleapiclient.errors.HttpError: &lt;HttpError 403 when requesting https://vision.googleapis.com/$discovery/rest?version=v1 returned "Project has not activated the vision.googleapis.com API. Please enable the API for project google.com:cloudsdktool (#32555940559)."&gt;
  </code></pre>
  
  <p>It appears that this error message:
  "No handlers could be found for logger "oauth2client.util"
  is actually masking a more detailed warning/error message 
  and that I can see the more detailed one by adding this code ...</p>
  
  <pre><code>import logging 
  logging.basicConfig()
  </code></pre>
  
  <p><a href="https://stackoverflow.com/a/29966147/2341218">https://stackoverflow.com/a/29966147/2341218</a></p>
  
  <pre><code>    &gt;python label_request.py faulkner.jpg 
  WARNING:oauth2client.util:build() takes at most 2 positional arguments (3 given)
  Traceback (most recent call last):
    File "label_request.py", line 47, in &lt;module&gt;
      main(args.image_file)
    File "label_request.py", line 21, in main
      service = build('vision', 'v1', http, discoveryServiceUrl=API_DISCOVERY_FILE)
    File "/usr/local/lib/python2.7/site-packages/oauth2client/util.py", line 137, in positional_wrapper
      return wrapped(*args, **kwargs)
    File "/usr/local/lib/python2.7/site-packages/googleapiclient/discovery.py", line 209, in build
      raise e
  googleapiclient.errors.HttpError: &lt;HttpError 403 when requesting https://vision.googleapis.com/$discovery/rest?version=v1 returned "Project has not activated the vision.googleapis.com API. Please enable the API for project google.com:cloudsdktool (#32555940559)."&gt;
  </code></pre>
  
  <p>So no I am stuck on this error message:<br>
  WARNING:oauth2client.util:build() takes at most 2 positional arguments (3 given)</p>
  
  <p>It has been suggested that this error can be avoided by using named parameters instead of positional notation.<br>
  <a href="https://stackoverflow.com/a/16643215/2341218">https://stackoverflow.com/a/16643215/2341218</a></p>
  
  <p>However, I am uncertain exactly where I might make this change.<br>
  I don't actually see the oauth2client.util:build() function in the code.<br>
  Here is the google code (slightly modified):</p>
  
  <pre><code>    &gt;cat label_request.py
  import argparse
  import base64
  import httplib2
  
  from apiclient.discovery import build
  from oauth2client.client import GoogleCredentials
  
  import logging
  logging.basicConfig()
  
  def main(photo_file):
    '''Run a label request on a single image'''
  
    API_DISCOVERY_FILE = 'https://vision.googleapis.com/$discovery/rest?version=v1'
    http = httplib2.Http()
  
    credentials = GoogleCredentials.get_application_default().create_scoped(
        ['https://www.googleapis.com/auth/cloud-platform'])
    credentials.authorize(http)
  
    service = build('vision', 'v1', http, discoveryServiceUrl=API_DISCOVERY_FILE)
  
    with open(photo_file, 'rb') as image:
      image_content = base64.b64encode(image.read())
      service_request = service.images().annotate(
        body={
          'requests': [{
            'image': {
              'content': image_content
             },
            'features': [{
              'type': 'LABEL_DETECTION',
              'maxResults': 1,
             }]
           }]
        })
      response = service_request.execute()
      label = response['responses'][0]['labelAnnotations'][0]['description']
      print('Found label: %s for %s' % (label, photo_file))
      return 0
  
  if __name__ == '__main__':
    parser = argparse.ArgumentParser()
    parser.add_argument(
      'image_file', help='The image you\'d like to label.')
    args = parser.parse_args()
    main(args.image_file)
  </code></pre>