github-to-sqlite icon indicating copy to clipboard operation
github-to-sqlite copied to clipboard

Commands for making authenticated API calls

Open simonw opened this issue 5 years ago • 7 comments

Similar to twitter-to-sqlite fetch, see https://github.com/dogsheep/twitter-to-sqlite/issues/51

simonw avatar Sep 17 '20 02:09 simonw

I'm going to start with github-to-sqlite get and github-to-sqlite post - I may add put and suchlike later on.

simonw avatar Sep 17 '20 02:09 simonw

I'd like a --paginate option that does the same thing as https://github.com/simonw/paginate-json

simonw avatar Sep 17 '20 02:09 simonw

Documentation: https://github.com/dogsheep/github-to-sqlite/blob/b02bf135485c0a7a3768868967f45a6b5e515289/README.md#making-authenticated-api-calls

simonw avatar Sep 17 '20 03:09 simonw

Fun demo of the --nl option:

github-to-sqlite get /users/simonw/repos --paginate --nl | sqlite-utils insert simonw.db repos - --nl

simonw avatar Sep 17 '20 03:09 simonw

Bug with endpoints that return dictionaries rather than arrays:

github-to-sqlite get /users/simonw
[
    "login",
    "id",
    "node_id",
    "avatar_url",
    "gravatar_id",
    "url",
    "html_url",
    "followers_url",
    "following_url",
    "gists_url",
    "starred_url",
    "subscriptions_url",
    "organizations_url",
    "repos_url",
    "events_url",
    "received_events_url",
    "type",
    "site_admin",
    "name",
    "company",
    "blog",
    "location",
    "email",
    "hireable",
    "bio",
    "twitter_username",
    "public_repos",
    "public_gists",
    "followers",
    "following",
    "created_at",
    "updated_at"
]

simonw avatar Sep 17 '20 03:09 simonw

It would be useful if you could pass an --accept option to this.

simonw avatar Sep 17 '20 04:09 simonw

Demo of --accept:

github-to-sqlite get /repos/simonw/datasette/readme --accept 'application/vnd.github.VERSION.html'

simonw avatar Oct 19 '20 05:10 simonw