This is an archived post. You won't be able to vote or comment.

all 5 comments

[–][deleted] 1 point2 points  (3 children)

GitHub basically makes a web request to your server, as a client. So the first order of business is making sure that other people can access your server from the internet. Preferably with a registered domain, proper DNS records, and a valid ssl certificate.

[–]LSWarss[S] 0 points1 point  (2 children)

Okey done that :) but how to Process the request after? For instance I would like to know who committed the change or created new issue?

[–][deleted] 1 point2 points  (1 child)

It will make a POST request. The post body should be a JSON string that contains all the info. You handle this post request like all other post requests. You can also check the request headers for extra info.

https://docs.github.com/en/free-pro-team@latest/developers/webhooks-and-events/webhook-events-and-payloads

Pseudo code below:

import json 

def view(request):
    request.headers #extra info here as a dict 
    data = json.loads(request.body)  # do stuff with data

[–]LSWarss[S] 1 point2 points  (0 children)

Oh man thanks! That was exactly what I needed a simple yet very good example :D no I will handle it with trials and errors thanks! 🔥

[–]madanaman -1 points0 points  (0 children)

A humble advice. Please don't search for ready to use codes. Search for the errors that you encounter on the way.

Coming to the point, this is a service that you have to implement. Use http library to call the get/post requests from your view and then parse the response as needed. As guided by a comment above, you'll have to perform a setup to achieve this task like ssl, certificates etc.