simonw / datasette.io

The official project website for Datasette
https://datasette.io
88 stars 21 forks source link

datasette-graphql page is missing the README #151

Closed simonw closed 10 months ago

simonw commented 10 months ago

https://datasette.io/plugins/datasette-graphql

CleanShot 2023-08-31 at 16 10 29@2x
simonw commented 10 months ago

https://datasette.io/content/repos?_sort=id&readme__isblank=1 shows three repos with blank READMEs:

simonw commented 10 months ago

https://github.com/simonw/datasette.io/blob/f3dd715c14eb67e8bc85d341f4581c1f502a17d0/build_directory.py#L113-L122

That --force-fetch-readmes flag looks interesting, it does this:

https://github.com/simonw/datasette.io/blob/f3dd715c14eb67e8bc85d341f4581c1f502a17d0/build_directory.py#L178-L185

Not sure how I could have ended up with a blank README though.

Maybe there was a glitch in the GitHub API and my code didn't notice that one time?

simonw commented 10 months ago

That seems likely - there's no error checking here:

https://github.com/simonw/datasette.io/blob/f3dd715c14eb67e8bc85d341f4581c1f502a17d0/build_directory.py#L178-L196

simonw commented 10 months ago

It looks like that should die with an unhandled exception if the API call fails:

>>> from github_to_sqlite.cli import repos as github_to_sqlite_repos
>>> github_to_sqlite_repos.callback("/tmp/db.db", auth="auth.json", repo=["simonw/datasette-graphql"], readme=True, readme_html=True, usernames=[], load=None)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/Users/simon/Dropbox/Development/github-to-sqlite/github_to_sqlite/cli.py", line 257, in repos
    repo_id = utils.save_repo(db, utils.fetch_repo(full_name, token))
                                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/simon/Dropbox/Development/github-to-sqlite/github_to_sqlite/utils.py", line 302, in fetch_repo
    response.raise_for_status()
  File "/Users/simon/.local/share/virtualenvs/github-to-sqlite-TxlyxhWj/lib/python3.11/site-packages/requests/models.py", line 1021, in raise_for_status
    raise HTTPError(http_error_msg, response=self)
requests.exceptions.HTTPError: 401 Client Error: Unauthorized for url: https://api.github.com/repos/simonw/datasette-graphql
simonw commented 10 months ago

I'm going to ship the site and see if it picks up that updated README.

simonw commented 10 months ago

It's back now: https://datasette.io/plugins/datasette-graphql