捕获和转换Web的工具

Python处理程序

Python API

产品描述

在调试处理程序时遇到问题吗? 尝试 回调处理程序测试工具。

此处描述的处理程序处理来自GrabzIt屏幕快照Web服务的回调。 该处理程序的URL在以下位置传递给GrabzIt: callBackURL 的参数 Save 方法。 但是,只有在可以通过 Int以太网

以下参数作为GET参数传递给处理程序。

如果要阻止对处理程序的所有访问,除了GrabzIt之外,请使用此方法 安全技术.

例如:

请记住,如果您的应用程序位于localhost上,则此回调将不起作用。

此示例展示了如何实现 GrabzIt Python 处理程序。这会捕获从 GrabzIt 服务传递给它的六个参数,包括传递给 GetResult 方法。

然后,此方法返回屏幕截图,即 saved在结果目录中。 但是如果 null 值是从返回 GetResult 方法,这表明发生了错误。

import os
import cgi
from GrabzIt import GrabzItClient
from ConfigParser import SafeConfigParser

form = cgi.FieldStorage()

message = form.getvalue("message")
customId = form.getvalue("customid")
id = form.getvalue("id")
filename = form.getvalue("filename")
format = form.getvalue("format")
targeterror = form.getvalue("targeterror")

# Custom id can be used to store user ids or whatever is needed for the later processing of the
# resulting screenshot

grabzIt = GrabzItClient.GrabzItClient("Sign in to view your Application Key", "Sign in to view your Application Secret")%>")
result = grabzIt.GetResult(id)

if result != None:
        # Ensure that the application has the correct rights for this directory.
        fo = open("results" + os.sep + filename, "wb")
        fo.write(result)
        fo.close()
        
print "Status: 200 OK"
print