GrabzIt's screenshot API is very flexible and can be called from a cronjob, a web page or application. The easiest way to add screenshots or HTML to image and more to your Python application is by following these steps:
To use the API you will first need to create an instance of the GrabzItClient class, passing your application key and application secret from your GrabzIt account to the constructor.
from GrabzIt import GrabzItClient
# Create the GrabzItClient class
# Replace "APPLICATION KEY", "APPLICATION SECRET" with the values from your account!
grabzIt = GrabzItClient.GrabzItClient("Sign in to view your Application Key", "Sign in to view your Application Secret")
Then use one of the image, PDF, animation or table methods to request that the GrabzIt service take a screenshot of the URL passed to it, convert HTML or more.
# To take a image screenshot
# Or to take a PDF screenshot
# Or to convert online videos into animated GIF's
# Or to capture table(s)
# To convert HTML into a image
# Or convert HTML into a PDF document
# Or convert HTML into a CSV, XLSX or JSON document
# To convert HTML file into a image
# Or convert HTML file into a PDF document
# Or convert HTML file into a CSV, XLSX or JSON document
Finally one of the two following save methods must be used to retrieve the capture. The recommended Save method requires the URL of a handler such as handler.py. This enables the capture to be retrived asynchronously, which stops your app having to wait while a screenshot is created.
The other save method is the SaveTo method and is synchonous it will force your app to wait while the screenshot is created.
filepath = "images/result.jpg"
There are many more options when creating web pages from screenshots or converting HTML including; configuring the browser height, browser width, screenshot height, screenshot width, the delay before a screenshot is taken and the image format of the screenshot. Find all these options and much more in the GrabzIt Client documentation.