@view_config(route_name='shortener_v1', renderer='jsonp')
def url_shortener(request):

    incoming_url = request.params.get('url')
    if not incoming_url:
        raise httpexceptions.HTTPBadRequest()

    try:
        url_handler = Url(request, url=incoming_url)
    except __HOLE__:
        raise httpexceptions.HTTPBadRequest()

    try:
        short_url = url_handler.shorten()
    except ShortenGenerationError:
        raise httpexceptions.HTTPInternalServerError()

    return short_url
dataset/ETHPy150Open gustavofonseca/nurl/nurl/views.py/url_shortener