@@ -496,6 +496,17 @@ class GitHubRepoProvider(RepoProvider):
496496 e.g. GitHub Enterprise.
497497 """ )
498498
499+ api_base_path = Unicode ('https://api.{hostname}' ,
500+ config = True ,
501+ help = """The base path of the GitHub API
502+
503+ Only necessary if not github.com,
504+ e.g. GitHub Enterprise.
505+
506+ Can use {hostname} for substitution,
507+ e.g. 'https://{hostname}/api/v3'
508+ """ )
509+
499510 client_id = Unicode (config = True ,
500511 help = """GitHub client id for authentication with the GitHub API
501512
@@ -649,9 +660,9 @@ def get_resolved_ref(self):
649660 if hasattr (self , 'resolved_ref' ):
650661 return self .resolved_ref
651662
652- api_url = "https://api.{hostname }/repos/{user}/{repo}/commits/{ref}" .format (
653- user = self .user , repo = self . repo , ref = self .unresolved_ref ,
654- hostname = self .hostname ,
663+ api_url = "{api_base_path }/repos/{user}/{repo}/commits/{ref}" .format (
664+ api_base_path = self .api_base_path . format ( hostname = self .hostname ),
665+ user = self .user , repo = self . repo , ref = self . unresolved_ref
655666 )
656667 self .log .debug ("Fetching %s" , api_url )
657668 cached = self .cache .get (api_url )
0 commit comments