@CheckAuth
  def LocalWebserverAuth(self, host_name='localhost',
                         port_numbers=[8080, 8090]):
    success = False
    port_number = 0
    for port in port_numbers:
      port_number = port
      try:
        httpd = ClientRedirectServer((host_name, port), ClientRedirectHandler)
      except socket.error as e:
        pass
      else:
        success = True
        break
    if success:
      oauth_callback = 'http://%s:%s/' % (host_name, port_number)
    else:
      print('Failed to start a local webserver. Please check your firewall')
      print('settings and locally running programs that may be blocking or')
      print('using configured ports. Default ports are 8080 and 8090.')
      raise AuthenticationError()
    self.flow.redirect_uri = oauth_callback
    authorize_url = self.GetAuthUrl()
    webbrowser.open(authorize_url, new=1, autoraise=True)
    print('Your browser has been opened to visit:')
    print()
    print('    ' + authorize_url)
    print()
    httpd.handle_request()
    if 'error' in httpd.query_params:
      print('Authentication request was rejected')
      raise AuthenticationRejected('User rejected authentication')
    if 'code' in httpd.query_params:
      return httpd.query_params['code']
    else:
      print('Failed to find "code" in the query parameters of the redirect.')
      print('Try command-line authentication')
      raise AuthenticationError('No code found in redirect')
Authenticate and authorize from user by creating local webserver and
dataset/ETHPy150Open googledrive/PyDrive/pydrive/auth.py/GoogleAuth.LocalWebserverAuth