The "not res.body" condition will never hit, because that state doesn't exist.  Same for "not res.code" -- the Response class sets the default value for 'code' as 200 during init.  So there's really no need to check these conditions.