@@ -434,6 +434,17 @@ class GitHubRepoProvider(RepoProvider):
434434 e.g. GitHub Enterprise.
435435 """ )
436436
437+ api_base_path = Unicode ('https://api.{hostname}' ,
438+ config = True ,
439+ help = """The base path of the GitHub API
440+
441+ Only necessary if not github.com,
442+ e.g. GitHub Enterprise.
443+
444+ Can use {hostname} for substitution,
445+ e.g. 'https://{hostname}/api/v3'
446+ """ )
447+
437448 client_id = Unicode (config = True ,
438449 help = """GitHub client id for authentication with the GitHub API
439450
@@ -580,9 +591,9 @@ def get_resolved_ref(self):
580591 if hasattr (self , 'resolved_ref' ):
581592 return self .resolved_ref
582593
583- api_url = "https://api.{hostname }/repos/{user}/{repo}/commits/{ref}" .format (
584- user = self .user , repo = self . repo , ref = self .unresolved_ref ,
585- hostname = self .hostname ,
594+ api_url = "{api_base_path }/repos/{user}/{repo}/commits/{ref}" .format (
595+ api_base_path = self .api_base_path . format ( hostname = self .hostname ),
596+ user = self .user , repo = self . repo , ref = self . unresolved_ref
586597 )
587598 self .log .debug ("Fetching %s" , api_url )
588599 cached = self .cache .get (api_url )
0 commit comments