I agree this is a regression and fairly bad for servers.
I would incline towards just amputating it by simply not using the
keyring module unless $DISPLAY is set: go back to getting the token
from a dot file. That is similar to what was done in previous
releases, and I don't think server or text-mode users would want us to
do otherwise, and it is probably easier than trying to persuade
python's keyring module not to try to connect to dbus etc. It may fix
some other bugs at the same time.