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

Method create_hook

github/Repository.py:1657–1680  ·  view source on GitHub ↗

:calls: `POST /repos/{owner}/{repo}/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

1655 return github.GitTree.GitTree(self._requester, headers, data, completed=True)
1656
1657 def create_hook(
1658 self,
1659 name: str,
1660 config: dict[str, str],
1661 events: Opt[list[str]] = NotSet,
1662 active: Opt[bool] = NotSet,
1663 ) -> Hook:
1664 """
1665 :calls: `POST /repos/{owner}/{repo}/hooks <https://docs.github.com/en/rest/reference/repos#webhooks>`_
1666 :param name: string
1667 :param config: dict
1668 :param events: list of string
1669 :param active: bool
1670 :rtype: :class:`github.Hook.Hook`
1671 """
1672 assert isinstance(name, str), name
1673 assert isinstance(config, dict), config
1674 assert is_optional_list(events, str), events
1675 assert is_optional(active, bool), active
1676 post_parameters = NotSet.remove_unset_items(
1677 {"name": name, "config": config, "events": events, "active": active}
1678 )
1679 headers, data = self._requester.requestJsonAndCheck("POST", f"{self.url}/hooks", input=post_parameters)
1680 return github.Hook.Hook(self._requester, headers, data, completed=True)
1681
1682 def create_issue(
1683 self,

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