0

i get this error everytime i run my code code = raw_input('Enter verification code: ').strip()

EOFError: EOF when reading a line i get this error everytime i run my code code = raw_input('Enter verification code: ').strip()

EOFError: EOF when reading a line

import httplib2

from apiclient import errors
from apiclient.discovery import build
from oauth2client.client import OAuth2WebServerFlow


# Copy your credentials from the console
CLIENT_ID = '***************.apps.googleusercontent.com'
CLIENT_SECRET = '******************VaHO'

# Check https://developers.google.com/admin-sdk/directory/v1/guides/authorizing for all available scopes
OAUTH_SCOPE = 'https://www.googleapis.com/auth/admin.directory.user'

# Redirect URI for installed apps
REDIRECT_URI = 'urn:ietf:wg:oauth:2.0:oob'

# Run through the OAuth flow and retrieve credentials
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)

# Create an httplib2.Http object and authorize it with our credentials
http = httplib2.Http()
http = credentials.authorize(http)

directory_service = build('admin', 'directory_v1', http=http)

all_users = []
page_token = None
params = {'customer': 'my_customer'}

while True:
  try:
    if page_token:
      params['pageToken'] = page_token
    current_page = directory_service.users().list(**params).execute()

    all_users.extend(current_page['users'])
    page_token = current_page.get('nextPageToken')
    if not page_token:
      break
  except errors.HttpError as error:
    print 'An error occurred: %s' % error
    break

for user in all_users:
  print user['primaryEmail']`enter code here`
WAYSER
  • 107
  • 1
  • 10
  • @marcadian this is a standard code given by google developers, that code is entered later on after i get over that error – WAYSER Jul 17 '15 at 07:11

1 Answers1

0

Try running it though command line, instead running through the IDE. I get the same error when I run my applications through my IDE.

Ian Bell
  • 1
  • 1