Actually you need to define the response before in case the request fails.
<pre>
response = None
</pre>
At the beggining of testForUrl