def GetOauthCredentials():
  if not settings.OAUTH_CLIENT_ID:
    raise RuntimeError('Missing OAUTH_CLIENT_ID setting!')
  if not settings.OAUTH_CLIENT_SECRET:
    raise RuntimeError('Missing OAUTH_CLIENT_SECRET setting!')

  httpd = oauth2client.tools.ClientRedirectServer(
      ('localhost', 0), oauth2client.tools.ClientRedirectHandler)
  httpd.timeout = 60
  flow = oauth2client.client.OAuth2WebServerFlow(
      client_id=settings.OAUTH_CLIENT_ID,
      client_secret=settings.OAUTH_CLIENT_SECRET,
      redirect_uri='http://%s:%s/' % httpd.server_address,
      scope=base_settings.OAUTH_SCOPE,
      )
  authorize_url = flow.step1_get_authorize_url()

  webbrowser.open(authorize_url, new=1, autoraise=True)
  httpd.handle_request()

  if 'error' in httpd.query_params:
    raise RuntimeError('Authentication request was rejected.')

  try:
    credentials = flow.step2_exchange(httpd.query_params)
  except oauth2client.client.FlowExchangeError as e:
    raise RuntimeError('Authentication has failed: %s' % e)
  else:
    logging.info('Authentication successful!')
    return credentials
Generates python callable binaries based on the math expression.
dataset/ETHPy150Open google/cauliflowervest/src/cauliflowervest/client/base_client.py/GetOauthCredentials--crossover with--dataset/ETHPy150Open sympy/sympy/sympy/utilities/autowrap.py/autowrap