title: how to set up Drive SDK so you dont need a success token each time you run .py
body: <p>At the moment i am needing to get a "success code" each time i want to run my .py app. to access my googdrive files which is a pain.</p>
  
  <p>I saw Ali Afshars great vid on <a href="https://developers.google.com/drive/search-parameters" rel="nofollow">https://developers.google.com/drive/search-parameters</a> where he uses:
  <code>from auth import http</code> to streamline this process.</p>
  
  <p>Not sure what this function should contain... Can you point me in the right direction, so that i can set up my .py to do this automatically ...or at least only once.</p>
  
  <p>many thanks</p>
  
  <p>Dav-o  </p>
  
  <hr>
  
  <p><strong>EDIT</strong> relevant current snip of code follows:</p>
  
  <pre><code>import logging
  logging.basicConfig()
  import httplib2
  import pprint
  from apiclient.discovery import build
  from apiclient.http import MediaFileUpload
  from oauth2client.client import *
  from apiclient import errors
  
  CLIENT_ID = "864350......ps.googleusercontent.com"
  CLIENT_SECRET = "sw0yb.....-zR6XWzEgM"
  OAUTH_SCOPE = 'https://www.googleapis.com/auth/drive' 
  REDIRECT_URI = 'urn:ietf:wg:oauth:2.0:oo...ooo' # Redirect URI for installed apps
  
  flow = OAuth2WebServerFlow(CLIENT_ID, CLIENT_SECRET, OAUTH_SCOPE, REDIRECT_URI)
  authorize_url = flow.step1_get_authorize_url()
  print 'Go to the following link in your browser: ' + authorize_url
  code = raw_input('Enter verification code: ').strip()
  credentials = flow.step2_exchange(code)
  
  http = httplib2.Http() 
  http = credentials.authorize(http)
  
  drive_service = build('drive', 'v2', http=http)
  </code></pre>