def set_connection_info(url, user=True):
 (section, keypath) = reg_info(user)
 try:
  hive = _winreg.ConnectRegistry(None, section)
  try:
   key = _winreg.CreateKey(hive, keypath)
  except:
   pass
  key = _winreg.OpenKey(hive, keypath)
  mykey = _winreg.CreateKey(key, 'api')
  _winreg.SetValueEx(mykey, 'url', None, _winreg.REG_SZ, url)
  _winreg.CloseKey(mykey)
  _winreg.CloseKey(key)
 except WindowsError:
  if user:
   set_connection_info(url, user=False)
  pass
 finally:
  _winreg.CloseKey(hive)

def set_connection_info ( url , user = True ) : ( section , keypath ) = reg_info ( user ) try : hive = _winreg . ConnectRegistry ( None , section ) try : key = _winreg . CreateKey ( hive , keypath ) except : pass key = _winreg . OpenKey ( hive , keypath ) mykey = _winreg . CreateKey ( key , 'api' ) _winreg . SetValueEx ( mykey , 'url' , None , _winreg . REG_SZ , url ) _winreg . CloseKey ( mykey ) _winreg . CloseKey ( key ) except WindowsError : if user : set_connection_info ( url , user = False ) pass finally : _winreg . CloseKey ( hive )
set api info in register .