def loginToSalesforce(username, password, sectoken):
  """
  Initializes global Salesforce connection handle, "sf"
  """
  global sf
  sf = SforceEnterpriseClient(wsdlFile)
  # API login seems to always need security token
  result = sf.login(username, password, sectoken)
  print 'Connected to "%s"' % result.serverUrl
  print '  as user "%s" Org Company Name: "%s" Org Id: "%s"' % \
    (result.userInfo.userFullName, 
     result.userInfo.organizationName, 
     result.userInfo.organizationId)
  print "  org type is %s sandbox" % (tern(result.sandbox,"","NOT"))
  global invokingUser
  invokingUser = result.userInfo.userFullName

  Initializes global Salesforce connection handle, "sf"
  
recipes/Python/577550_Custom_import_script/recipe-577550.py