Ignore invalid responses.

Not sure if this is the right approach.

You can simplify this by just doing 'if not response or not response.content' since it won't evaluate the rest of the expression if response is falsey (e.g. None).