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

Method refresh_access_token

github/ApplicationOAuth.py:157–183  ·  view source on GitHub ↗

:calls: `POST /login/oauth/access_token `_ :param refresh_token: string

(self, refresh_token: str)

Source from the content-addressed store, hash-verified

155 )
156
157 def refresh_access_token(self, refresh_token: str) -> AccessToken:
158 """
159 :calls: `POST /login/oauth/access_token <https://docs.github.com/en/developers/apps/identifying-and-authorizing-users-for-github-apps>`_
160 :param refresh_token: string
161 """
162 assert isinstance(refresh_token, str)
163 post_parameters = {
164 "client_id": self.client_id,
165 "client_secret": self.client_secret,
166 "grant_type": "refresh_token",
167 "refresh_token": refresh_token,
168 }
169
170 headers, data = self._checkError(
171 *self._requester.requestJsonAndCheck(
172 "POST",
173 self.get_oauth_url("/access_token"),
174 headers={"Accept": "application/json"},
175 input=post_parameters,
176 )
177 )
178
179 return github.AccessToken.AccessToken(
180 requester=self._requester,
181 headers=headers,
182 attributes=data,
183 )
184
185 @staticmethod
186 def _checkError(headers: dict[str, Any], data: Any) -> tuple[dict[str, Any], Any]:

Callers 5

_refreshMethod · 0.80

Calls 3

_checkErrorMethod · 0.95
get_oauth_urlMethod · 0.95
requestJsonAndCheckMethod · 0.80

Tested by

no test coverage detected