def appendArgs(url, args):
 if hasattr(args, 'items'):
  args = args.items()
  args.sort()
 else:
  args = list(args)
 if (len(args) == 0):
  return url
 if ('?' in url):
  sep = '&'
 else:
  sep = '?'
 i = 0
 for (k, v) in args:
  if (type(k) is not str):
   k = k.encode('UTF-8')
  if (type(v) is not str):
   v = v.encode('UTF-8')
  args[i] = (k, v)
  i += 1
 return ('%s%s%s' % (url, sep, urlencode(args)))

def appendArgs ( url , args ) : if hasattr ( args , 'items' ) : args = args . items ( ) args . sort ( ) else : args = list ( args ) if ( len ( args ) == 0 ) : return url if ( '?' in url ) : sep = '&' else : sep = '?' i = 0 for ( k , v ) in args : if ( type ( k ) is not str ) : k = k . encode ( 'UTF-8' ) if ( type ( v ) is not str ) : v = v . encode ( 'UTF-8' ) args [ i ] = ( k , v ) i += 1 return ( '%s%s%s' % ( url , sep , urlencode ( args ) ) )
append query arguments to a http(s) url .