You should not declare r. In python you don't need to declare variables.
It is not clear from your question, but I bet that your output includes que "Connection refused" string. In that case, there's no need to try to access r.content: as the connection has been refused, nothing can be there. Just perform a proper error management:
import requests, zipfile, StringIO
zip_file_url = "http://www.blog.pythonlibrary.org/wp-content/uploads/2012/06/wxDbViewer.zip"
try:
r = requests.get(zip_file_url, stream=True)
except requests.exceptions.ConnectionError:
print "Connection refused"
exit() # That's an option, just finish the program
if r is not None:
z = zipfile.ZipFile(StringIO.StringIO(r.content))
else:
# That's the other option, check that the variable contains
# a proper value before referencing it.
print("I told you, there was an error while connecting!")