dvershinin/lastversion

CRITICAL: API request was denied despite using an API token. Missing scopes?

Closed this issue · 5 comments

Project with incorrect version

Initialy, I found the error just by looking for the last version of Pip, but...

To Reproduce

lastversion --verbose --version

Expected behavior

The version of Lastversion

Program output

The first time:

I was on a Python environment, I check for the version of Pip and get:

CRITICAL: API request was denied despite using an API token. Missing scopes?

Immediately, I deactivate the environment, run the command without arguments and get the usual:

lastversion: error: the following arguments are required: <repo URL or string>

The second time:

After running the command without arguments, I tried to get the last version of Lastversion and I get:

Traceback (most recent call last):
  File "/home/admin/.local/bin/lastversion", line 8, in <module>
    sys.exit(main())
             ^^^^^^
  File "/home/admin/.local/share/pipx/venvs/lastversion/lib64/python3.12/site-packages/lastversion/lastversion.py", line 723, in main
    args = parser.parse_args(argv)
           ^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib64/python3.12/argparse.py", line 1891, in parse_args
    args, argv = self.parse_known_args(args, namespace)
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib64/python3.12/argparse.py", line 1924, in parse_known_args
    namespace, args = self._parse_known_args(args, namespace)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib64/python3.12/argparse.py", line 2136, in _parse_known_args
    start_index = consume_optional(start_index)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib64/python3.12/argparse.py", line 2076, in consume_optional
    take_action(action, args, option_string)
  File "/usr/lib64/python3.12/argparse.py", line 2000, in take_action
    action(self, namespace, argument_values, option_string)
  File "/home/admin/.local/share/pipx/venvs/lastversion/lib64/python3.12/site-packages/lastversion/argparse_version.py", line 32, in __call__
    last_version = lastversion.latest(lastversion.__self__)
                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/admin/.local/share/pipx/venvs/lastversion/lib64/python3.12/site-packages/lastversion/lastversion.py", line 230, in latest
    release = project.get_latest(pre_ok=pre_ok, major=repo_data.get("major", major))
              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/admin/.local/share/pipx/venvs/lastversion/lib64/python3.12/site-packages/lastversion/GitHubRepoSession.py", line 585, in get_latest
    formal_release = self.get_formal_release_for_tag(tag_name)
                     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/admin/.local/share/pipx/venvs/lastversion/lib64/python3.12/site-packages/lastversion/GitHubRepoSession.py", line 404, in get_formal_release_for_tag
    self.ensure_formal_releases_fetched()
  File "/home/admin/.local/share/pipx/venvs/lastversion/lib64/python3.12/site-packages/lastversion/GitHubRepoSession.py", line 397, in ensure_formal_releases_fetched
    r = self.repo_query("/releases")
        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/admin/.local/share/pipx/venvs/lastversion/lib64/python3.12/site-packages/lastversion/GitHubRepoSession.py", line 242, in repo_query
    return self.get(url)
           ^^^^^^^^^^^^^
  File "/home/admin/.local/share/pipx/venvs/lastversion/lib64/python3.12/site-packages/lastversion/GitHubRepoSession.py", line 183, in get
    raise ApiCredentialsError(
lastversion.exceptions.ApiCredentialsError: API request was denied despite using an API token. Missing scopes?

After that, I remembered having installed lastversion with Pipx, so I created a new environment, and after installing lastversion I get pretty much the same I think

Traceback (most recent call last):
  File "/home/admin/.local/bin/lastversion", line 8, in <module>
    sys.exit(main())
             ^^^^^^
  File "/home/admin/.local/lib/python3.12/site-packages/lastversion/lastversion.py", line 735, in main
    args = parser.parse_args(argv)
           ^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib64/python3.12/argparse.py", line 1891, in parse_args
    args, argv = self.parse_known_args(args, namespace)
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib64/python3.12/argparse.py", line 1924, in parse_known_args
    namespace, args = self._parse_known_args(args, namespace)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib64/python3.12/argparse.py", line 2136, in _parse_known_args
    start_index = consume_optional(start_index)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib64/python3.12/argparse.py", line 2076, in consume_optional
    take_action(action, args, option_string)
  File "/usr/lib64/python3.12/argparse.py", line 2000, in take_action
    action(self, namespace, argument_values, option_string)
  File "/home/admin/.local/lib/python3.12/site-packages/lastversion/argparse_version.py", line 32, in __call__
    last_version = lastversion.latest(lastversion.__self__)
                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/admin/.local/lib/python3.12/site-packages/lastversion/lastversion.py", line 232, in latest
    release = project.get_latest(pre_ok=pre_ok, major=repo_data.get("major", major))
              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/admin/.local/lib/python3.12/site-packages/lastversion/GitHubRepoSession.py", line 611, in get_latest
    ret = self.get_release_from_feed(pre_ok, major)
          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/admin/.local/lib/python3.12/site-packages/lastversion/GitHubRepoSession.py", line 572, in get_release_from_feed
    formal_release = self.get_formal_release_for_tag(tag_name)
                     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/admin/.local/lib/python3.12/site-packages/lastversion/GitHubRepoSession.py", line 404, in get_formal_release_for_tag
    self.ensure_formal_releases_fetched()
  File "/home/admin/.local/lib/python3.12/site-packages/lastversion/GitHubRepoSession.py", line 397, in ensure_formal_releases_fetched
    r = self.repo_query("/releases")
        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/admin/.local/lib/python3.12/site-packages/lastversion/GitHubRepoSession.py", line 242, in repo_query
    return self.get(url)
           ^^^^^^^^^^^^^
  File "/home/admin/.local/lib/python3.12/site-packages/lastversion/GitHubRepoSession.py", line 183, in get
    raise ApiCredentialsError(
lastversion.exceptions.ApiCredentialsError: API request was denied despite using an API token. Missing scopes?

Now, lastversion gives me only the long output.

OS: Linux fedora 6.6.4-200.fc39.x86_64
Bash version: 5.2.21(1)-release
Python version: Python 3.12.0

Remarks

  • I just installed Oh My Bash, it's clean, I just modified the theme

That's all I can give you for now guys, if there is some info missing sorry but I'm kinda of newbie on reporting issues on GitHub, just let me know. I will try not to update my system until I get feedback from you.

@jefebromden most likely your Github API key has expired or is incorrect. Check environment variables like GITHUB_API_TOKEN (in your ~/.bashrc for example)

You're right, both are true:

  • I forgot to source my .bash_profile on the new .bashrc created by Oh My Bash. I keep all my variables and tokens there.
  • My token expired back in may, I haven't using GitHub for a while

Anyway, it's funny because I had been using lastversion last week, when I first installed it, without problems with the old token.

@jefebromden you must live a happy life if you can afford to not use GitHub, or tech in general, for a while :-)

Hahaha I wish. Actually I was out due to personal problems. Don't get me wrong, I'm not a programmer or anything, coding is a growing interest since the pandemic, I'm still looking for my place on the FOSS ecosystem, I know a little about this and that. I think I prefer having an holistic view before committing to anything.

In lastversion 3.4.4 I've included more reasons as to this failure so it's less confusing for future users. Thank you!