Derive the GitHub API base URL from a repository URL. For github.com: https://api.github.com/ For enterprise: https://{host}/api/v3/
(repository_url: str)
| 288 | |
| 289 | |
| 290 | def _get_github_api_url(repository_url: str) -> str: |
| 291 | """Derive the GitHub API base URL from a repository URL. |
| 292 | |
| 293 | For github.com: https://api.github.com/ |
| 294 | For enterprise: https://{host}/api/v3/ |
| 295 | """ |
| 296 | parsed = urlparse(repository_url) |
| 297 | if parsed.hostname == "github.com": |
| 298 | return "https://api.github.com/" |
| 299 | return f"{parsed.scheme}://{parsed.hostname}/api/v3/" |
| 300 | |
| 301 | |
| 302 | @api_view(["POST"]) |
no outgoing calls
no test coverage detected
searching dependent graphs…