Search code examples
pythongitgithookswebhooksbitbucket-api

Bitbucket post management service hooks


I want to get commit messages to my web app.

I am doing following:

  1. In my git repository, added a POST service with post url as

    http:/ /localhost:9000/myGitHook/ or http ://167.34.56.13:9000/myGitHook/.

in my urls.py I have :

URLS = [r'/', Main,
          :
          :
    (r'/myGitHook/', GitHook),
          :
          :
]

the above url is mapped properly to following handler:

class GitHook(tornado.web.RequestHandler):
    def get(self, *args, **kwargs):
        print self.request
        #do something

    def post(self, *args, **kwargs):
        print self.request
        #do something
  1. modified a file and pushed it to the repository.
  2. I can see commit in the my bitbucket repository commit list, but the above POST url is not even triggered.
  3. Then I found this. It says that you cannot use localhost for post service management.

I am not doing anything else beyond these process.

Please suggest how to do it in the development environment.

Any kind of help would be really appreciated.

Thanks in Advance.


Solution

  • Bitbucket server needs to access your hook and on localhost it can't. You can try using ProxyLocal or something similar, which will proxy your local web server and make it available for the public .