Esempio n. 1
0
def find_proxy(url, host=None):
    """
  Finds proxy string for the given url and host. If host is not
  defined, it's extracted from the url.
  """
    if host is None:
        m = _URL_REGEX.match(url)
        if not m:
            raise URLError(url)
        if len(m.groups()) is 1:
            host = m.groups()[0]
        else:
            raise URLError(url)
    return _pacparser.find_proxy(url, host)
Esempio n. 2
0
def find_proxy(url, host=None):
    """
  Finds proxy string for the given url and host. If host is not
  defined, it's extracted from the url.
  """
    if host is None:
        m = _URL_REGEX.match(url)
        if not m:
            raise URLError(url)
        if len(m.groups()) is 1:
            host = m.groups()[0]
        else:
            raise URLError(url)
    return _pacparser.find_proxy(url, host)
Esempio n. 3
0
def find_proxy(url, host=None):
  """
  Finds proxy string for the given url and host. If host is not
  defined, it's extracted from the url.
  """
  if host is None:
    m = url_regex.match(url)
    if not m:
      print('URL: %s is not a valid URL' % url)
      return None
    if len(m.groups()) is 1:
      host = m.groups()[0]
    else:
      print('URL: %s is not a valid URL' % url)
      return None
  return _pacparser.find_proxy(url, host)
Esempio n. 4
0
def find_proxy(url, host=None):
    """
  Finds proxy string for the given url and host. If host is not
  defined, it's extracted from the url.
  """
    if host is None:
        m = _url_regex.match(url)
        if not m:
            print('URL: %s is not a valid URL' % url)
            return None
        if len(m.groups()) is 1:
            host = m.groups()[0]
        else:
            print('URL: %s is not a valid URL' % url)
            return None
    return _pacparser.find_proxy(url, host)