(request, code)
This redirects to the long URL from short URL
This redirects to the long URL from short URL
This redirects to the long URL from short URL
def link_unshorten(request, code):
    """This redirects to the long URL from short URL"""
    pygmy_client = pygmy_client_object(settings, request)
    if request.method == 'GET':
        try:
            url_obj = pygmy_client.unshorten(code)
        except UnAuthorized:
            return redirect('/link/secret?next={}'.format(code))
        except (LinkExpired, ObjectNotFound) as e:
            return render(request, '404.html',
                          context=API_ERROR(e.args[0]), status=404)
        long_url = url_obj['long_url']
        return redirect(long_url, permanent=True)
def link_unshorten ( request , code ) : pygmy_client = pygmy_client_object ( settings , request ) if request . method == 'GET' : try : url_obj = pygmy_client . unshorten ( code ) except UnAuthorized : return redirect ( '/link/secret?next={}' . format ( code ) ) except ( LinkExpired , ObjectNotFound ) as e : return render ( request , '404.html' , context = API_ERROR ( e . args [ 0 ] ) , status = 404 ) long_url = url_obj [ 'long_url' ] return redirect ( long_url , permanent = True )