Added optional ref parameter for Repository.get_contents

This commit is contained in:
Christopher Gilbert
2012-12-23 12:10:29 +00:00
parent 293e88d7aa
commit 09df2f629c
+6 -2
View File
@@ -592,12 +592,16 @@ class Repository(GithubObject.GithubObject):
url_parameters
)
def get_contents(self, path):
def get_contents(self, path, ref=GithubObject.NotSet):
assert isinstance(path, (str, unicode)), path
assert ref is GithubObject.NotSet or isinstance(ref, (str, unicode)), ref
url_parameters = dict()
if ref is not GithubObject.NotSet:
url_parameters["ref"] = ref
headers, data = self._requester.requestAndCheck(
"GET",
self.url + "/contents" + path,
None,
url_parameters,
None
)
return ContentFile.ContentFile(self._requester, data, completed=True)