Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Command for importing events #14

Open
simonw opened this issue Nov 29, 2019 · 3 comments
Open

Command for importing events #14

simonw opened this issue Nov 29, 2019 · 3 comments
Labels
enhancement New feature or request

Comments

@simonw
Copy link
Collaborator

simonw commented Nov 29, 2019

Eg from https://api.github.com/users/simonw/events

Docs here: https://developer.github.com/v3/activity/events/#list-events-performed-by-a-user

@simonw simonw added the enhancement New feature or request label Nov 29, 2019
@simonw
Copy link
Collaborator Author

simonw commented Nov 29, 2019

I should build the command to persist ETags and obey their polling guidelines:

Events are optimized for polling with the "ETag" header. If no new events have been triggered, you will see a "304 Not Modified" response, and your current rate limit will be untouched. There is also an "X-Poll-Interval" header that specifies how often (in seconds) you are allowed to poll. In times of high server load, the time may increase. Please obey the header.

@simonw
Copy link
Collaborator Author

simonw commented Nov 30, 2019

Prototype:

pip install sqlite-utils paginate-json
paginate-json "https://api.github.com/users/simonw/events" | sqlite-utils insert /tmp/events.db events - --pk=id

@simonw
Copy link
Collaborator Author

simonw commented Apr 14, 2020

Since events include payloads with full object representations in them (for issues, repos and more) running this command every few minutes may be all it takes to keep a constant copy of everything updated in a very rate-limit friendly manner (thanks to the ETags).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant