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

Method update

github/GithubObject.py:638–662  ·  view source on GitHub ↗

Check and update the object with conditional request :rtype: Boolean value indicating whether the object is changed.

(
        self, additional_headers: dict[str, Any] | None = None, parameters: dict[str, Any] | None = None
    )

Source from the content-addressed store, hash-verified

636 self.__completed = True
637
638 def update(
639 self, additional_headers: dict[str, Any] | None = None, parameters: dict[str, Any] | None = None
640 ) -> bool:
641 """
642 Check and update the object with conditional request :rtype: Boolean value indicating whether the object is
643 changed.
644 """
645 conditionalRequestHeader = dict()
646 if self.etag is not None:
647 conditionalRequestHeader[Consts.REQ_IF_NONE_MATCH] = self.etag
648 if self.last_modified is not None:
649 conditionalRequestHeader[Consts.REQ_IF_MODIFIED_SINCE] = self.last_modified
650 if additional_headers is not None:
651 conditionalRequestHeader.update(additional_headers)
652
653 status, responseHeaders, output = self._requester.requestJson(
654 "GET", self._url.value, parameters=parameters, headers=conditionalRequestHeader
655 )
656 if status == 304:
657 return False
658 else:
659 headers, data = self._requester._Requester__check(status, responseHeaders, output) # type: ignore
660 self._storeAndUseAttributes(headers, data)
661 self.__completed = True
662 return True
663
664 def _useAttributes(self, attributes: dict[str, Any]) -> None:
665 if "url" in attributes: # pragma no branch

Callers 2

_completeMethod · 0.45
updateMethod · 0.45

Calls 2

requestJsonMethod · 0.80

Tested by

no test coverage detected