E0d/handle 301s

@jarv @davestgermain This PR refactors status_code handling to be more defensive and explicitly lumps 301 with 302 for xqueue because of https://openedx.atlassian.net/browse/LMS-11150
@symbolist it looks like what will happen here is that because `r = None`, it'll retry the request after logging in. This is inside a while loop.

(Although, I suppose it's possible for it to be stuck in an infinite loop if the login continues to redirect. And there wouldn't be any delay between requests, either...)