def dump_response_on_file(response, filepath=None):
"""Useful when debugging responses. Calls to this method should not be
committed."""
if not filepath:
from tempfile import mkstemp
_, filepath = mkstemp(text=True)
f = file(filepath, 'w')
f.write(response.content)
f.close()
return filepath
def load_response_on_firefox(response):
""" load html of a response for debugging purposes
Attention: Calls to this method should not be
committed.
"""
import subprocess
fpath = dump_response_on_file(response)
subprocess.call(['firefox', fpath])
Comments