Skip to content

Commit

Permalink
Update documentation.
Browse files Browse the repository at this point in the history
  • Loading branch information
tomprince committed Dec 22, 2016
1 parent feed615 commit 5e9c7f9
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 5 deletions.
3 changes: 2 additions & 1 deletion docs/core/examples/stdiodemo.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,8 @@ def do_quit(self):

def do_check(self, url):
"""check <url>: Attempt to download the given web page"""
client.getPage(url).addCallback(
client.Agent(reactor).request('GET', url).addCallback(
client.readBody).addCallback(
self.__checkSuccess).addErrback(
self.__checkFailure)

Expand Down
5 changes: 3 additions & 2 deletions docs/core/howto/threading.rst
Original file line number Diff line number Diff line change
Expand Up @@ -113,13 +113,14 @@ To get a result from some blocking code back into the reactor thread, we can use
Similarly, you want some code running in a non-reactor thread wants to invoke some code in the reactor thread and get its result, you can use :api:`twisted.internet.threads.blockingCallFromThread <blockingCallFromThread>`::

from twisted.internet import threads, reactor, defer
from twisted.web.client import getPage
from twisted.web.client import Agent
from twisted.web.error import Error

def inThread():
agent = Agent(reactor)
try:
result = threads.blockingCallFromThread(
reactor, getPage, "http://twistedmatrix.com/")
reactor, agent.request, "GET", "http://twistedmatrix.com/"))
except Error, exc:
print(exc)
else:
Expand Down
5 changes: 3 additions & 2 deletions docs/web/examples/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,9 @@ Examples
twisted.web.client
------------------

- :download:`getpage.py` - use ``twisted.web.client.getPage`` to download a web page.
- :download:`dlpage.py` - add callbacks to ``twisted.web.client.downloadPage`` to display errors that occur when downloading a web page
- :download:`httpclient.py` - use ``twisted.web.client.Agent`` to download a web page.
- (deprecated) :download:`getpage.py` - use ``twisted.web.client.getPage`` to download a web page.
- (deprecated) :download:`dlpage.py` - add callbacks to ``twisted.web.client.downloadPage`` to display errors that occur when downloading a web page


XML-RPC
Expand Down

0 comments on commit 5e9c7f9

Please sign in to comment.