def parse_url(url_string):
  parts = urlparse.urlparse(url_string)
  url = Url()
  if parts[0]:
    url.protocol = parts[0]
  if parts[1]:
    host_parts = parts[1].split(':')
    if host_parts[0]:
      url.host = host_parts[0]
    if len(host_parts) > 1:
      url.port = host_parts[1]
  if parts[2]:
    url.path = parts[2]
  if parts[4]:
    param_pairs = parts[4].split('&')
    for pair in param_pairs:
      pair_parts = pair.split('=')
      if len(pair_parts) > 1:
        url.params[urllib.unquote_plus(pair_parts[0])] = (
            urllib.unquote_plus(pair_parts[1]))
      elif len(pair_parts) == 1:
        url.params[urllib.unquote_plus(pair_parts[0])] = None
  return url
Creates a Url object which corresponds to the URL string.
dataset/ETHPy150Open CollabQ/CollabQ/vendor/atom/url.py/parse_url