title: Python - HttpError when using google drive API
body: <p>I am using python 3.4 to leverage the Google API to access and read files from a users google drive. If a user has already used the app before they should have a credentials file so I was hoping to be able to test if the credentials are still valid by attempting to list the files on the users drive. The idea being if this errors then the app knows it needs to ask for access again.</p>
  
  <p>After a lot of searching I've tried to piece together code from the following Examples:<br>
  <a href="https://developers.google.com/drive/v2/reference/files/list" rel="nofollow">Google API commands</a><br>
  <a href="https://developers.google.com/api-client-library/python/start/get_started#simple" rel="nofollow">Google Example</a></p>
  
  <p>I currently have the following pieces of code:</p>
  
  <pre><code>import httplib2
  from apiclient.discovery import build
  from oauth2client.file import Storage
  from oauth2client.client import AccessTokenRefreshError
  from oauth2client.client import OAuth2WebServerFlow
  
  def getAccess():
      flow = OAuth2WebServerFlow(client_id, client_secret, scope,     redirect_uri="urn:ietf:wg:oauth:2.0:oob")
      auth_uri = flow.step1_get_authorize_url()
      print("Please go to the following webpage and copy and paste the access key onto the command line:\n" + auth_uri + "\n")
      code = input("Please enter your access code:\n")
      credentials = flow.step2_exchange(code)
      storage.put(credentials)
  
  client_id = MYCLIENT_ID
  client_secret = MYCLIENT_SECRET
  scope = "https://www.googleapis.com/auth/drive"
  
  storage = Storage('~/credentials.dat')
  credentials = storage.get()
  
  if credentials is None or credentials.invalid:
      getAccess()
  else:
      try:
          http = httplib2.Http()
          http = credentials.authorize(http)
          service = build('drive', 'v2', http=http)
          param = {}
          service.files().list(**param).execute()
      except:
          getAccess()
  </code></pre>
  
  <p>However the service.files().list(**param).execute() line produces the following error message:</p>
  
  <pre><code>Traceback (most recent call last):
    File "GoogleAuth.py", line 64, in &lt;module&gt;
      service.files().list(**param).execute()
    File "C:\Anaconda3\lib\site-packages\oauth2client\util.py", line 137, in     positional_wrapper
      return wrapped(*args, **kwargs)
    File "C:\Anaconda3\lib\site-packages\googleapiclient\http.py", line 729, in execute
      raise HttpError(resp, content, uri=self.uri)
  googleapiclient.errors.HttpError
  </code></pre>
  
  <p>I've tried playing around with a few different combinations such as:</p>
  
  <pre><code>service.files().list().execute()
  service.apps().list().execute()
  </code></pre>
  
  <p>However I still get the same error message. Any idea what's going on ?</p>