1 # Copyright (c) Twisted Matrix Laboratories.
2 # See LICENSE for details.
5 This example demonstrates how to use downloadPage.
8 $ python dlpage.py <url>
10 Don't forget the http:// when you type a URL!
13 from twisted.internet import reactor
14 from twisted.web.client import downloadPage
15 from twisted.python.util import println
18 # The function downloads a page and saves it to a file, in this case, it saves
20 downloadPage(sys.argv[1], "foo").addCallbacks(
21 lambda value:reactor.stop(),
22 lambda error:(println("an error occurred",error),reactor.stop()))