MCPcopy Index your code
hub / github.com/PyGithub/PyGithub / create_hook

Method create_hook

github/Organization.py:733–761  ·  view source on GitHub ↗

:calls: `POST /orgs/{org}/hooks `_ :param name: string :param config: dict :param events: list of string :param active: bool :rtype: :class:`github.Hook.Hook`

(
        self,
        name: str,
        config: dict[str, str],
        events: Opt[list[str]] = NotSet,
        active: Opt[bool] = NotSet,
    )

Source from the content-addressed store, hash-verified

731 return github.Repository.Repository(self._requester, headers, data, completed=True)
732
733 def create_hook(
734 self,
735 name: str,
736 config: dict[str, str],
737 events: Opt[list[str]] = NotSet,
738 active: Opt[bool] = NotSet,
739 ) -> Hook:
740 """
741 :calls: `POST /orgs/{org}/hooks <https://docs.github.com/en/rest/reference/orgs#webhooks>`_
742 :param name: string
743 :param config: dict
744 :param events: list of string
745 :param active: bool
746 :rtype: :class:`github.Hook.Hook`
747 """
748 assert isinstance(name, str), name
749 assert isinstance(config, dict), config
750 assert is_optional_list(events, str), events
751 assert is_optional(active, bool), active
752 post_parameters: dict[str, Any] = NotSet.remove_unset_items(
753 {
754 "name": name,
755 "config": config,
756 "events": events,
757 "active": active,
758 }
759 )
760 headers, data = self._requester.requestJsonAndCheck("POST", f"{self.url}/hooks", input=post_parameters)
761 return github.Hook.Hook(self._requester, headers, data, completed=True)
762
763 def create_project(self, name: str, body: Opt[str] = NotSet) -> github.Project.Project:
764 """

Callers

nothing calls this directly

Calls 4

is_optional_listFunction · 0.90
is_optionalFunction · 0.90
remove_unset_itemsMethod · 0.80
requestJsonAndCheckMethod · 0.80

Tested by

no test coverage detected