Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9205643
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T23:59:51+00:00 2026-06-17T23:59:51+00:00

Github offers to send Post-receive hooks to an URL of your choice when there’s

  • 0

Github offers to send Post-receive hooks to an URL of your choice when there’s activity on your repo.
I want to write a small Python command-line/background (i.e. no GUI or webapp) application running on my computer (later on a NAS), which continually listens for those incoming POST requests, and once a POST is received from Github, it processes the JSON information contained within. Processing the json as soon as I have it is no problem.
The POST can come from a small number of IPs given by github; I plan/hope to specify a port on my computer where it should get sent.

The problem is, I don’t know enough about web technologies to deal with the vast number of options you find when searching.. do I use Django, Requests, sockets,Flask, microframeworks…? I don’t know what most of the terms involved mean, and most sound like they offer too much/are too big to solve my problem – I’m simply overwhelmed and don’t know where to start.

Most tutorials about POST/GET I could find seem to be concerned with either sending or directly requesting data from a website, but not with continually listening for it.

I feel the problem is not really a difficult one, and will boil down to a couple of lines, once I know where to go/how to do it. Can anybody offer pointers/tutorials/examples/sample code?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-17T23:59:52+00:00Added an answer on June 17, 2026 at 11:59 pm

    Here’s a basic web.py example for receiving data via POST and doing something with it (in this case, just printing it to stdout):

    import web
    
    urls = ('/.*', 'hooks')
    
    app = web.application(urls, globals())
    
    class hooks:
        def POST(self):
            data = web.data()
            print
            print 'DATA RECEIVED:'
            print data
            print
            return 'OK'
    
    if __name__ == '__main__':
        app.run()
    

    I POSTed some data to it using hurl.it (after forwarding 8080 on my router), and saw the following output:

    $ python hooks.py 
    http://0.0.0.0:8080/
    
    DATA RECEIVED: 
    test=thisisatest&test2=25
    
    50.19.170.198:33407 - - [27/Jan/2013 10:18:37] "HTTP/1.1 POST /hooks" - 200 OK
    

    You should be able to swap out the print statements for your JSON processing.

    To specify the port number, call the script with an extra argument:

    $ python hooks.py 1234 
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Github supports post-receive hooks for notification of code changes, documented here . Now, to
Is there a service that offers this functionality: When pushing to GitHub, it runs
Github offers a way to let a URL know when a project has been
I have a repo (hosted on Github). There is a fork of my repo.
github url I am using a simple search that displays search results: @adds =
On Github there is an description how to build the framework from scratch. How
I want to modify and view github wikis with local editor like Emacs, and
I am in need of a site that offers the same services as Github
Github provides notifications via mail or web, based on watched repos. But is there
In github, you can comment on lines in a commit. Is there a way

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.