File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1111from googleapiclient .discovery import build
1212import googleapiclient .http
1313import oauth2client .client
14+ import sys
1415
16+ # Checking Python version to avoid input errors
17+ if sys .version_info < (3 ,5 ,0 ):
18+ sys .stderr .write ("You need python 3.x or later to run this script\n " )
19+ exit (1 )
20+
1521# OAuth 2.0 scope that will be authorized.
1622# Check https://developers.google.com/drive/scopes for all available scopes.
1723OAUTH2_SCOPE = 'https://www.googleapis.com/auth/drive'
3238flow .redirect_uri = oauth2client .client .OOB_CALLBACK_URN
3339authorize_url = flow .step1_get_authorize_url ()
3440print ('Go to the following link in your browser: ' + authorize_url )
35- code = raw_input ('Enter verification code: ' ).strip ()
41+ code = input ('Enter verification code: ' ).strip ()
3642credentials = flow .step2_exchange (code )
3743
3844# Create an authorized Drive API client.
You can’t perform that action at this time.
0 commit comments