Retrieve GitHub access tokens from various sources
copied from cf-staging / ghtokenWhen writing a Python program for interacting with GitHub's API, you'll likely want to use the local user's GitHub access token for authentication. Asking the user to provide the token every time is undesirable, so you'd rather look up the token in some well-known storage location. The problem is, there have been so many places to store GitHub tokens supported by different programs over the years, and asking your users to migrate to a new one shouldn't be necessary.
That's where ghtoken
comes in: it provides a single function for
checking multiple well-known sources for GitHub access tokens plus separate
functions for querying individual sources in case you need to combine the
queries in novel ways.