Skip to content

Commit

Permalink
added open_in_browser to debugging doc
Browse files Browse the repository at this point in the history
  • Loading branch information
pablohoffman committed Nov 4, 2012
1 parent dd55067 commit c9b690d
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions docs/topics/debug.rst
Expand Up @@ -103,6 +103,24 @@ Fortunately, the :command:`shell` is your bread and butter in this case (see
else:
inspect_response(response, self)

See also: :ref:`topics-shell-inspect-response`.

Open in browser
===============

Sometimes you just want to see how a certain response looks in a browser, you
can use the ``open_in_browser`` function for that. Here is an example of how
you would use it::

from scrapy.utils.response import open_in_browser

def parse_details(self, response):
if "item name" not in response.body:
open_in_browser(response)

``open_in_browser`` will open a browser with the response received by Scrapy at
that point, adjusting the `base tag`_ so that images and styles are displayed
properly.

Logging
=======
Expand All @@ -123,3 +141,5 @@ available in all future runs should they be necessary again::
level=log.WARNING)

For more information, check the :ref:`topics-logging` section.

.. _base tag: http://www.w3schools.com/tags/tag_base.asp

0 comments on commit c9b690d

Please sign in to comment.