-
-
Notifications
You must be signed in to change notification settings - Fork 1.7k
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
Example: Listen for New Events with PyGithub and Pyramid #930
Conversation
I thought this |
I thought it was the Github Services that was being deprecated. The PubSubHubHub section mentions that callback strings using Using webhooks to do this would certainly be good. I'll see if I can get that to either replace/go along with this example. |
@LeviMatus At least I've only used webhooks in my projects and it's been good so far. But I may be wrong too 😄 some ref: |
I probably just misunderstand the deprecation of Github Services and its relation to I've updated my example accordingly. I've removed the subscription and created a webhook that results in the same usage. |
I am thinking whether to make it one level higher and more generic as a webhook example itself, because this will be applicable for not just repo event, but all webhook events. Also FYI there is an official example here by Github which happens to be authored by me some time ago, this may give you some ideas. Let me know what you think ;) |
Having this be a more generic webhook example makes sense. This example from Github is cool. I particularly like that you can specify which functions to call based on a header value, like I'll rename and/or move this to a place more suitable for working with Webhooks. I'll also get around to trying this out in a fashion similar to that example. |
Don't forget to add the index for the new file in |
if __name__ == "__main__": | ||
config = Configurator() | ||
|
||
create_webhook() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe you can add a mention this step can also be done from Github itself. (under repo settings)
Good catches and ideas. I've added a commit to address them. |
doc/examples/Webhook.rst
Outdated
|
||
This is a programatic approach to creating webhooks with PyGithub's API. If you wish, this can be done | ||
manually at your repository's page on Github in the "Settings" section. There is a option there to work with | ||
and confgurd Webhooks. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
small typo here
@LeviMatus Awesome stuff! |
## What does this change do? Adds a small demo implementation of how one might use webhooks to listen for new events in a given repository. ### Additions #### doc/examples/Webhook.rst Adds a new `.rst` file, `Webhook.rst`, which can be used for demonstrating the usage of Webhooks in PyGithub. The example that I've added shows how to continually listen for events using Pyramid in conjunction with PyGithub. ## Motivation This example is in the spirit of PyGithub#874. [It was asked](PyGithub#874 (comment)) that someone provide an example of how to listen to events from a repository. ## How has this been tested? I've built the docs locally and made sure the HTML is generated as expected. ## Screenshots ![webhook1](https://user-images.githubusercontent.com/16039329/46991191-40e58900-d0db-11e8-87e4-d5cf2cc18b0a.png) ![webhook2](https://user-images.githubusercontent.com/16039329/46991193-42af4c80-d0db-11e8-9b20-678f70e6baee.png)
What does this change do?
Adds a small demo implementation of how one might use webhooks to listen for
new events in a given repository.
Additions
doc/examples/Webhook.rst
Adds a new
.rst
file,Webhook.rst
, which can be used for demonstrating the usage of Webhooks in PyGithub.The example that I've added shows how to continually listen for events using Pyramid in conjunction with PyGithub.
Motivation
This example is in the spirit of #874. It was asked that someone provide an example of how to listen to events from a repository.
How has this been tested?
I've built the docs locally and made sure the HTML is generated as expected.
Screenshots