Take screenshot from a website and return token screenshot as httpsresponse for download in django

i want to take a screenshot from a website and return token screenshot as https for download. I am using Html2Image lib. i am tring this code:

def certification1(request, *args, **kwargs):
    hti = Html2Image()
    image = hti.screenshot(url='https://www.python.org', save_as='screenshot.png')
    response = HttpResponse(image, content_type='png')
    return response

but it return url of saved image. like this

enter image description here

how can i return token image for download?

Back to Top