ApeWorX / ape

The smart contract development tool for Pythonistas, Data Scientists, and Security Professionals
https://apeworx.io
Apache License 2.0
895 stars 131 forks source link

Error when calling ape plugins list #2363

Closed fubuloubu closed 3 weeks ago

fubuloubu commented 3 weeks ago

Have you ensured that all of these are up to date?

What version of Ape are you on?

0.8.19

What command(s) is the bug in?

ape plugins list

Operating System

Linux

Description

$ ape plugins list
Traceback (most recent call last):
  File "~/.local/bin/ape", line 8, in <module>
    sys.exit(cli())
             ^^^^^
  File "site-packages/click/core.py", line 1157, in __call__
    return self.main(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "site-packages/click/core.py", line 1078, in main
    rv = self.invoke(ctx)
         ^^^^^^^^^^^^^^^^
  File "site-packages/ape/_cli.py", line 113, in invoke
    return super().invoke(ctx)
           ^^^^^^^^^^^^^^^^^^^
  File "site-packages/click/core.py", line 1688, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
                           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "site-packages/click/core.py", line 1688, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
                           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "site-packages/click/core.py", line 1434, in invoke
    return ctx.invoke(self.callback, **ctx.params)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "site-packages/click/core.py", line 783, in invoke
    return __callback(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "site-packages/click/decorators.py", line 92, in new_func
    return ctx.invoke(f, obj, *args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "site-packages/click/core.py", line 783, in invoke
    return __callback(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "site-packages/ape_plugins/_cli.py", line 115, in _list
    metadata = PluginMetadataList.load(cli_ctx.plugin_manager)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "site-packages/ape/plugins/_utils.py", line 208, in load
    plugins = plugins.union(github_client.available_plugins)
                            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "python3.11/functools.py", line 1001, in __get__
    val = self.func(instance)
          ^^^^^^^^^^^^^^^^^^^
  File "site-packages/ape/utils/_github.py", line 98, in available_plugins
    return {
           ^
  File "site-packages/ape/utils/_github.py", line 98, in <setcomp>
    return {
           ^
  File "site-packages/ape/utils/_github.py", line 107, in get_org_repos
    response = self._get(f"orgs/{self.ORGANIZATION_NAME}/repos", params=params)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "site-packages/ape/utils/_github.py", line 222, in _get
    return self._request("GET", url, params=params)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "site-packages/ape/utils/_github.py", line 227, in _request
    response.raise_for_status()
  File "site-packages/requests/models.py", line 1024, in raise_for_status
    raise HTTPError(http_error_msg, response=self)
requests.exceptions.HTTPError: 401 Client Error: Unauthorized for url: https://api.github.com/orgs/ApeWorX/repos?per_page=100&page=1

Reproduction code

ape plugins list
linear[bot] commented 3 weeks ago

APE-1850 Error when calling ape plugins list

fubuloubu commented 3 weeks ago

I appear to be getting this with older versions, thinking this is just the lack of a good error message or fallback handling

fubuloubu commented 3 weeks ago

ah, my token was expired

antazoey commented 3 weeks ago

The token shouldnt even be necessary since you didnt do --all, so will fix that will be perf as well