I think this should be an 'elif' or 'else'  block (since I think this is the last one). That way, in case both username-password and oauth credentials are passed, we only process username-password and don't add both to the headers.