/ Published in: Python
                    
                                        
Capture Web Screenshots easily with the [GrabzIt ](http://grabz.it/) Python API
You will need the free [GrabzIt Code Library](http://grabz.it/api/python/download.aspx) to get started.
                You will need the free [GrabzIt Code Library](http://grabz.it/api/python/download.aspx) to get started.
                            
                                Expand |
                                Embed | Plain Text
                            
                        
                        Copy this code and paste it in your HTML
#
# The Python that takes the screenshot
#
import GrabzItClient
#Create the GrabzItClient class
#Replace "APPLICATION KEY", "APPLICATION SECRET" with the values from your account!
grabzIt = GrabzItClient.GrabzItClient("APPLICATION KEY", "APPLICATION SECRET")
#Take the picture the method will return the unique identifier assigned to this task
id = grabzIt.TakePicture("http://www.google.com", "http://www.example.com/GrabzItHandler.py")
#
# The GrabzItHandler file that saves the screenshot
#
import os
import cgi
import GrabzItClient
form = cgi.FieldStorage()
message = form.getvalue("message")
customId = form.getvalue("customid")
id = form.getvalue("id")
filename = form.getvalue("filename")
#Custom id can be used to store user ids or whatever is needed for the later processing of the
#resulting screenshot
grabzIt = GrabzItClient.GrabzItClient("APPLICATION KEY", "APPLICATION SECRET")
result = grabzIt.GetPicture(id)
if result != None:
#Ensure that the application has the correct rights for this directory.
fo = open("images" + os.sep + filename, "wb")
fo.write(result)
fo.close()
print "Status: 200 OK"
URL: http://grabz.it/api/python/
Comments
 Subscribe to comments
                    Subscribe to comments
                
                