It seems _login()
has seen been updated. You can still follow the login procedure above for the most part, but you need to use a token instead of username/password combination with _login():
from huggingface_hub.commands.user import _login
from huggingface_hub import HfApi
api = HfApi()
_login(hf_api = api, token = "TOKEN")
Tokens can be generated in the Access Tokens page of your Hugging Face profile.