Exemplo n.º 1
0
def redirect_(url_id):
    try:
        result = Urls.get_original_url(url_id=url_id)
        if result:
            return redirect(result[0]["original_url"])
        raise Exception("url_id: %s not found in db. It is probably expired." %
                        url_id)
    except Exception as e:
        return jsonify({"message": str(e)})
Exemplo n.º 2
0
def redirect_redirect(url_id, sub_url):
    try:
        result = Urls.get_original_url(url_id=url_id)
        if result:
            url = "%s/%s" % (result[0]["original_url"], sub_url)
            return redirect(url)
        raise Exception("url_id not found in db. It is probably expired." %
                        url_id)
    except Exception as e:
        return jsonify({"message": str(e)})