def addprojecthook(self, project_id, url, push=False, issues=False, merge_requests=False, tag_push=False):
        data = {"id": project_id, "url": url}
        data['push_events'] = int(bool(push))
        data['issues_events'] = int(bool(issues))
        data['merge_requests_events'] = int(bool(merge_requests))
        data['tag_push_events'] = int(bool(tag_push))
        request = requests.post("{0}/{1}/hooks".format(self.projects_url, project_id),
                                headers=self.headers, data=data, verify=self.verify_ssl, auth=self.auth, timeout=self.timeout)
        if request.status_code == 201:
            return request.json()
        else:
            return False
add a hook to a project
dataset/ETHPy150Open pyapi-gitlab/pyapi-gitlab/gitlab/__init__.py/Gitlab.addprojecthook