Screamshot’s documentation

Screamshot is a python library to capture screenshots of web pages.

Specification

It is based on the Pyppeteer library that uses the Asyncio package and therefore asynchronous functions. Thus, you may experience some thread issues.

Installation

Screamshot requires Python 3.5 or more.

Install by pip from PyPI:

pip install screamshot

Usage

Exemple: a Django view that uses screamshot

# views.py in a Django project
from django.http import HttpResponse

import asyncio

from screamshot import generate_bytes_img_prom

def home(request):
    loop = asyncio.get_event_loop()
    future = asyncio.Future()

    asyncio.ensure_future(
        generate_bytes_img_prom('https://www.google.fr', future))
    loop.run_until_complete(future)

    return HttpResponse(future.result(), content_type='image')

In this case, if you use manage.py, the server must be launched using --nothreading and --noreload as argument.