예제 #1
0
def parse_result(params, paths, base):
    url = '%s/' % base if not base.endswith('/') else base
    url += '/'.join(imap(str, ifilter(None, paths)))
    url = url.rstrip('/')
    url = utils.url_quote(url)  # Ensure url is valid
    url += '?%s' % urllib.urlencode(params) if params and url else ''
    return url
예제 #2
0
def pipe_urlinput(context=None, _INPUT=None, conf=None, **kwargs):
    """An input that prompts the user for a url and yields it forever.
    Not loopable.

    Parameters
    ----------
    context : pipe2py.Context object
    _INPUT : unused
    conf : {
        'name': {'value': 'parameter name'},
        'prompt': {'value': 'User prompt'},
        'default': {'value': 'default value'},
        'debug': {'value': 'debug value'}
    }

    Yields
    ------
    _OUTPUT : url
    """
    value = utils.get_input(context, conf)
    value = utils.url_quote(value)

    while True:
        yield value