The basicauth command demonstrates using the github.BasicAuthTransport, including handling two-factor authentication. This won't currently work for accounts that use SMS to receive one-time passwords.
Deprecation Notice: GitHub will discontinue password authentication to the API. You must now authenticate to the GitHub API with an API token, such as an OAuth access token, GitHub App installation access token, or personal access token, depending on what you need to do with the token. Password authentication to the API will be removed on November 13, 2020. See the tokenauth example for details.