Skip to content

Conversation

@vprivat-ads
Copy link
Contributor

In case GITHUB_TOKEN is undefined and we have exceeded our anonymous rate limit, we get the following output:

/home/xxx/projects/stac/stac-extensions.github.io/python/create_readme.py:19: DeprecationWarning: The 'warn' method is deprecated, use 'warning' instead
  logger.warn("No GITHUB_TOKEN found in env")
No GITHUB_TOKEN found in env
response invalid
response invalid
Traceback (most recent call last):
  File "/home/xxx/projects/stac/stac-extensions.github.io/python/create_readme.py", line 185, in <module>
    main()
  File "/home/xxx/projects/stac/stac-extensions.github.io/python/create_readme.py", line 166, in main
    data = get_extensions()
           ^^^^^^^^^^^^^^^^
  File "/home/xxx/projects/stac/stac-extensions.github.io/python/create_readme.py", line 71, in get_extensions
    data = get_sources()
           ^^^^^^^^^^^^^
  File "/home/xxx/projects/stac/stac-extensions.github.io/python/create_readme.py", line 58, in get_sources
    data.append(from_gh(repo.json(), True))
                ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/xxx/projects/stac/stac-extensions.github.io/python/create_readme.py", line 23, in from_gh
    "title": response["name"],
             ~~~~~~~~^^^^^^^^
KeyError: 'name'

With this PR we get a more user-friendly output:

No GITHUB_TOKEN found in env
stac-extensions not available: 403 Client Error: rate limit exceeded for url: https://api.github.com/users/stac-extensions/repos?per_page=1000
community repo not available: 403 Client Error: rate limit exceeded for url: https://api.github.com/repos/crim-ca/dlm-extension
community repo not available: 403 Client Error: rate limit exceeded for url: https://api.github.com/repos/Terradue/stac-extensions-disaster
community repo not available: 403 Client Error: rate limit exceeded for url: https://api.github.com/repos/openrsgis/trainingdml-ai-extension
community repo not available: 403 Client Error: rate limit exceeded for url: https://api.github.com/repos/stacchain/merkle-tree
community repo not available: 403 Client Error: rate limit exceeded for url: https://api.github.com/repos/IFRCGo/monty-stac-extension
Something likely went wrong as there are not enough repos listed, don't override README

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant