:calls: `POST /app/installations/{installation_id}/access_tokens `
(
self, installation_id: int, permissions: dict[str, str] | None = None
)
| 256 | return self.auth.create_jwt(expiration) |
| 257 | |
| 258 | def get_access_token( |
| 259 | self, installation_id: int, permissions: dict[str, str] | None = None |
| 260 | ) -> InstallationAuthorization: |
| 261 | """ |
| 262 | :calls: `POST /app/installations/{installation_id}/access_tokens <https://docs.github.com/en/rest/apps/apps#create-an-installation-access-token-for-an-app>` |
| 263 | """ |
| 264 | if permissions is None: |
| 265 | permissions = {} |
| 266 | |
| 267 | if not isinstance(permissions, dict): |
| 268 | raise GithubException(status=400, data={"message": "Invalid permissions"}, headers=None) |
| 269 | |
| 270 | body = {"permissions": permissions} |
| 271 | headers, response = self.__requester.requestJsonAndCheck( |
| 272 | "POST", |
| 273 | f"/app/installations/{installation_id}/access_tokens", |
| 274 | headers=self._get_headers(), |
| 275 | input=body, |
| 276 | ) |
| 277 | |
| 278 | return InstallationAuthorization( |
| 279 | requester=self.__requester, |
| 280 | headers=headers, |
| 281 | attributes=response, |
| 282 | ) |
| 283 | |
| 284 | @deprecated("Use get_repo_installation") |
| 285 | def get_installation(self, owner: str, repo: str) -> Installation: |
no test coverage detected