Exemplo n.º 1
0
def redirect_url(path):
    try:
        short_url = ShortURL.get(path)
        webhook = WEBHOOK
        if short_url.webhook:
            webhook = short_url.webhook
        webhook = get_hook(webhook, path)
        if webhook:
            call_url(webhook)
        return redirect(short_url.redirection_url, code=302)
    except ShortURL.DoesNotExist:
        return redirect(NOT_FOUND_URL, code=302)
Exemplo n.º 2
0
def redirect_url(path):
    try:
        short_url = ShortURL.get(path)
        webhook = WEBHOOK
        if short_url.webhook:
            webhook = short_url.webhook
        webhook = get_hook(webhook, path)
        if webhook:
            call_url(webhook)
        return redirect(short_url.redirection_url, code=302)
    except ShortURL.DoesNotExist:
        # return render_template('./404/index.html'), 404
        return jsonify(error="URL Not Found. Make sure you entered the URL correctly."), 404