diff --git a/github/AuthenticatedUser.py b/github/AuthenticatedUser.py index e035f9a1..d403893f 100644 --- a/github/AuthenticatedUser.py +++ b/github/AuthenticatedUser.py @@ -258,6 +258,7 @@ class AuthenticatedUser(github.GithubObject.CompletableGithubObject): "POST", "/user/emails", None, + None, post_parameters ) @@ -272,6 +273,7 @@ class AuthenticatedUser(github.GithubObject.CompletableGithubObject): "PUT", "/user/following/" + following._identity, None, + None, None ) @@ -286,6 +288,7 @@ class AuthenticatedUser(github.GithubObject.CompletableGithubObject): "PUT", "/user/starred/" + starred._identity, None, + None, None ) @@ -300,6 +303,7 @@ class AuthenticatedUser(github.GithubObject.CompletableGithubObject): "PUT", "/user/subscriptions/" + subscription._identity, None, + None, None ) @@ -314,6 +318,7 @@ class AuthenticatedUser(github.GithubObject.CompletableGithubObject): "PUT", "/user/watched/" + watched._identity, None, + None, None ) @@ -347,6 +352,7 @@ class AuthenticatedUser(github.GithubObject.CompletableGithubObject): "POST", "/authorizations", None, + None, post_parameters ) return github.Authorization.Authorization(self._requester, headers, data, completed=True) @@ -362,6 +368,7 @@ class AuthenticatedUser(github.GithubObject.CompletableGithubObject): "POST", "/repos/" + repo.owner.login + "/" + repo.name + "/forks", None, + None, None ) return github.Repository.Repository(self._requester, headers, data, completed=True) @@ -387,6 +394,7 @@ class AuthenticatedUser(github.GithubObject.CompletableGithubObject): "POST", "/gists", None, + None, post_parameters ) return github.Gist.Gist(self._requester, headers, data, completed=True) @@ -408,6 +416,7 @@ class AuthenticatedUser(github.GithubObject.CompletableGithubObject): "POST", "/user/keys", None, + None, post_parameters ) return github.UserKey.UserKey(self._requester, headers, data, completed=True) @@ -458,6 +467,7 @@ class AuthenticatedUser(github.GithubObject.CompletableGithubObject): "POST", "/user/repos", None, + None, post_parameters ) return github.Repository.Repository(self._requester, headers, data, completed=True) @@ -500,6 +510,7 @@ class AuthenticatedUser(github.GithubObject.CompletableGithubObject): "PATCH", "/user", None, + None, post_parameters ) self._useAttributes(data) @@ -515,6 +526,7 @@ class AuthenticatedUser(github.GithubObject.CompletableGithubObject): "GET", "/authorizations/" + str(id), None, + None, None ) return github.Authorization.Authorization(self._requester, headers, data, completed=True) @@ -540,6 +552,7 @@ class AuthenticatedUser(github.GithubObject.CompletableGithubObject): "GET", "/user/emails", None, + None, None ) return data @@ -679,6 +692,7 @@ class AuthenticatedUser(github.GithubObject.CompletableGithubObject): "GET", "/user/keys/" + str(id), None, + None, None ) return github.UserKey.UserKey(self._requester, headers, data, completed=True) @@ -706,6 +720,7 @@ class AuthenticatedUser(github.GithubObject.CompletableGithubObject): "GET", "/notifications/threads/" + id, None, + None, None ) return github.Notification.Notification(self._requester, headers, data, completed=True) @@ -770,6 +785,7 @@ class AuthenticatedUser(github.GithubObject.CompletableGithubObject): "GET", "/repos/" + self.login + "/" + name, None, + None, None ) return github.Repository.Repository(self._requester, headers, data, completed=True) @@ -858,6 +874,7 @@ class AuthenticatedUser(github.GithubObject.CompletableGithubObject): "GET", "/user/following/" + following._identity, None, + None, None ) return status == 204 @@ -873,6 +890,7 @@ class AuthenticatedUser(github.GithubObject.CompletableGithubObject): "GET", "/user/starred/" + starred._identity, None, + None, None ) return status == 204 @@ -888,6 +906,7 @@ class AuthenticatedUser(github.GithubObject.CompletableGithubObject): "GET", "/user/subscriptions/" + subscription._identity, None, + None, None ) return status == 204 @@ -903,6 +922,7 @@ class AuthenticatedUser(github.GithubObject.CompletableGithubObject): "GET", "/user/watched/" + watched._identity, None, + None, None ) return status == 204 @@ -919,6 +939,7 @@ class AuthenticatedUser(github.GithubObject.CompletableGithubObject): "DELETE", "/user/emails", None, + None, post_parameters ) @@ -933,6 +954,7 @@ class AuthenticatedUser(github.GithubObject.CompletableGithubObject): "DELETE", "/user/following/" + following._identity, None, + None, None ) @@ -947,6 +969,7 @@ class AuthenticatedUser(github.GithubObject.CompletableGithubObject): "DELETE", "/user/starred/" + starred._identity, None, + None, None ) @@ -961,6 +984,7 @@ class AuthenticatedUser(github.GithubObject.CompletableGithubObject): "DELETE", "/user/subscriptions/" + subscription._identity, None, + None, None ) @@ -975,6 +999,7 @@ class AuthenticatedUser(github.GithubObject.CompletableGithubObject): "DELETE", "/user/watched/" + watched._identity, None, + None, None ) diff --git a/github/Authorization.py b/github/Authorization.py index 2289fd34..f287a2b6 100644 --- a/github/Authorization.py +++ b/github/Authorization.py @@ -115,6 +115,7 @@ class Authorization(github.GithubObject.CompletableGithubObject): "DELETE", self.url, None, + None, None ) @@ -148,6 +149,7 @@ class Authorization(github.GithubObject.CompletableGithubObject): "PATCH", self.url, None, + None, post_parameters ) self._useAttributes(data) diff --git a/github/Commit.py b/github/Commit.py index 5e909213..ad744e39 100644 --- a/github/Commit.py +++ b/github/Commit.py @@ -131,6 +131,7 @@ class Commit(github.GithubObject.CompletableGithubObject): "POST", self.url + "/comments", None, + None, post_parameters ) return github.CommitComment.CommitComment(self._requester, headers, data, completed=True) @@ -157,6 +158,7 @@ class Commit(github.GithubObject.CompletableGithubObject): "POST", self._parentUrl(self._parentUrl(self.url)) + "/statuses/" + self.sha, None, + None, post_parameters ) return github.CommitStatus.CommitStatus(self._requester, headers, data, completed=True) diff --git a/github/CommitComment.py b/github/CommitComment.py index 55c2cf86..061737bf 100644 --- a/github/CommitComment.py +++ b/github/CommitComment.py @@ -131,6 +131,7 @@ class CommitComment(github.GithubObject.CompletableGithubObject): "DELETE", self.url, None, + None, None ) @@ -148,6 +149,7 @@ class CommitComment(github.GithubObject.CompletableGithubObject): "PATCH", self.url, None, + None, post_parameters ) self._useAttributes(data) diff --git a/github/Download.py b/github/Download.py index 86b7ae44..a4b3b656 100644 --- a/github/Download.py +++ b/github/Download.py @@ -201,6 +201,7 @@ class Download(github.GithubObject.CompletableGithubObject): "DELETE", self.url, None, + None, None ) diff --git a/github/Gist.py b/github/Gist.py index a1497685..de4ded9e 100644 --- a/github/Gist.py +++ b/github/Gist.py @@ -173,6 +173,7 @@ class Gist(github.GithubObject.CompletableGithubObject): "POST", self.url + "/comments", None, + None, post_parameters ) return github.GistComment.GistComment(self._requester, headers, data, completed=True) @@ -186,6 +187,7 @@ class Gist(github.GithubObject.CompletableGithubObject): "POST", self.url + "/forks", None, + None, None ) return Gist(self._requester, headers, data, completed=True) @@ -199,6 +201,7 @@ class Gist(github.GithubObject.CompletableGithubObject): "DELETE", self.url, None, + None, None ) @@ -220,6 +223,7 @@ class Gist(github.GithubObject.CompletableGithubObject): "PATCH", self.url, None, + None, post_parameters ) self._useAttributes(data) @@ -235,6 +239,7 @@ class Gist(github.GithubObject.CompletableGithubObject): "GET", self.url + "/comments/" + str(id), None, + None, None ) return github.GistComment.GistComment(self._requester, headers, data, completed=True) @@ -260,6 +265,7 @@ class Gist(github.GithubObject.CompletableGithubObject): "GET", self.url + "/star", None, + None, None ) return status == 204 @@ -273,6 +279,7 @@ class Gist(github.GithubObject.CompletableGithubObject): "DELETE", self.url + "/star", None, + None, None ) @@ -285,6 +292,7 @@ class Gist(github.GithubObject.CompletableGithubObject): "PUT", self.url + "/star", None, + None, None ) diff --git a/github/GistComment.py b/github/GistComment.py index 6c7e2461..f0b5c80c 100644 --- a/github/GistComment.py +++ b/github/GistComment.py @@ -91,6 +91,7 @@ class GistComment(github.GithubObject.CompletableGithubObject): "DELETE", self.url, None, + None, None ) @@ -108,6 +109,7 @@ class GistComment(github.GithubObject.CompletableGithubObject): "PATCH", self.url, None, + None, post_parameters ) self._useAttributes(data) diff --git a/github/GitRef.py b/github/GitRef.py index a666156b..84ec00c5 100644 --- a/github/GitRef.py +++ b/github/GitRef.py @@ -67,6 +67,7 @@ class GitRef(github.GithubObject.CompletableGithubObject): "DELETE", self.url, None, + None, None ) @@ -88,6 +89,7 @@ class GitRef(github.GithubObject.CompletableGithubObject): "PATCH", self.url, None, + None, post_parameters ) self._useAttributes(data) diff --git a/github/GithubObject.py b/github/GithubObject.py index bc32b257..4fddd29d 100644 --- a/github/GithubObject.py +++ b/github/GithubObject.py @@ -148,6 +148,7 @@ class GithubObject(object): status, responseHeaders, output = self._requester.requestJson( "GET", self._url, + None, conditionalRequestHeader, None ) @@ -183,6 +184,7 @@ class CompletableGithubObject(GithubObject): "GET", self._url, None, + None, None ) self._storeAndUseAttributes(headers, data) diff --git a/github/Hook.py b/github/Hook.py index 721bdd7a..ea0be67b 100644 --- a/github/Hook.py +++ b/github/Hook.py @@ -115,6 +115,7 @@ class Hook(github.GithubObject.CompletableGithubObject): "DELETE", self.url, None, + None, None ) @@ -151,6 +152,7 @@ class Hook(github.GithubObject.CompletableGithubObject): "PATCH", self.url, None, + None, post_parameters ) self._useAttributes(data) @@ -164,6 +166,7 @@ class Hook(github.GithubObject.CompletableGithubObject): "POST", self.url + "/tests", None, + None, None ) diff --git a/github/Issue.py b/github/Issue.py index 1cdcc6bb..260967d3 100644 --- a/github/Issue.py +++ b/github/Issue.py @@ -204,6 +204,7 @@ class Issue(github.GithubObject.CompletableGithubObject): "POST", self.url + "/labels", None, + None, post_parameters ) @@ -221,6 +222,7 @@ class Issue(github.GithubObject.CompletableGithubObject): "POST", self.url + "/comments", None, + None, post_parameters ) return github.IssueComment.IssueComment(self._requester, headers, data, completed=True) @@ -234,6 +236,7 @@ class Issue(github.GithubObject.CompletableGithubObject): "DELETE", self.url + "/labels", None, + None, None ) @@ -271,6 +274,7 @@ class Issue(github.GithubObject.CompletableGithubObject): "PATCH", self.url, None, + None, post_parameters ) self._useAttributes(data) @@ -286,6 +290,7 @@ class Issue(github.GithubObject.CompletableGithubObject): "GET", self._parentUrl(self.url) + "/comments/" + str(id), None, + None, None ) return github.IssueComment.IssueComment(self._requester, headers, data, completed=True) @@ -337,6 +342,7 @@ class Issue(github.GithubObject.CompletableGithubObject): "DELETE", self.url + "/labels/" + label._identity, None, + None, None ) @@ -352,6 +358,7 @@ class Issue(github.GithubObject.CompletableGithubObject): "PUT", self.url + "/labels", None, + None, post_parameters ) diff --git a/github/IssueComment.py b/github/IssueComment.py index 5a3c62da..c1af97f8 100644 --- a/github/IssueComment.py +++ b/github/IssueComment.py @@ -100,6 +100,7 @@ class IssueComment(github.GithubObject.CompletableGithubObject): "DELETE", self.url, None, + None, None ) @@ -117,6 +118,7 @@ class IssueComment(github.GithubObject.CompletableGithubObject): "PATCH", self.url, None, + None, post_parameters ) self._useAttributes(data) diff --git a/github/Label.py b/github/Label.py index b3c75501..b961af18 100644 --- a/github/Label.py +++ b/github/Label.py @@ -68,6 +68,7 @@ class Label(github.GithubObject.CompletableGithubObject): "DELETE", self.url, None, + None, None ) @@ -88,6 +89,7 @@ class Label(github.GithubObject.CompletableGithubObject): "PATCH", self.url, None, + None, post_parameters ) self._useAttributes(data) diff --git a/github/Legacy.py b/github/Legacy.py index 1ed760e2..a0e3493f 100644 --- a/github/Legacy.py +++ b/github/Legacy.py @@ -59,6 +59,7 @@ class PaginatedList(github.PaginatedList.PaginatedListBase): "GET", self.__url, args, + None, None ) self.__continue = len(data[self.__key]) > 0 diff --git a/github/MainClass.py b/github/MainClass.py index ae1f612f..4eab8517 100644 --- a/github/MainClass.py +++ b/github/MainClass.py @@ -106,6 +106,7 @@ class Github(object): 'GET', '/rate_limit', None, + None, None ) return self.__requester.rate_limiting @@ -121,6 +122,7 @@ class Github(object): 'GET', '/rate_limit', None, + None, None ) return self.__requester.rate_limiting_resettime @@ -146,6 +148,7 @@ class Github(object): "GET", "/users/" + login, None, + None, None ) return github.NamedUser.NamedUser(self.__requester, headers, data, completed=True) @@ -178,6 +181,7 @@ class Github(object): "GET", "/orgs/" + login, None, + None, None ) return github.Organization.Organization(self.__requester, headers, data, completed=True) @@ -192,6 +196,7 @@ class Github(object): "GET", "/repos/" + full_name, None, + None, None ) return Repository.Repository(self.__requester, headers, data, completed=True) @@ -224,6 +229,7 @@ class Github(object): "GET", "/gists/" + id, None, + None, None ) return github.Gist.Gist(self.__requester, headers, data, completed=True) @@ -286,6 +292,7 @@ class Github(object): "GET", "/legacy/user/email/" + email, None, + None, None ) return github.NamedUser.NamedUser(self.__requester, headers, Legacy.convertUser(data["user"]), completed=False) @@ -309,6 +316,7 @@ class Github(object): "POST", "/markdown", None, + None, post_parameters ) return data @@ -322,6 +330,7 @@ class Github(object): "GET", "/hooks", None, + None, None ) return [HookDescription.HookDescription(self.__requester, headers, attributes, completed=True) for attributes in data] @@ -335,6 +344,7 @@ class Github(object): "GET", "/gitignore/templates", None, + None, None ) return data @@ -349,6 +359,7 @@ class Github(object): "GET", "/gitignore/templates/" + name, None, + None, None ) return GitignoreTemplate.GitignoreTemplate(self.__requester, headers, attributes, completed=True) diff --git a/github/Milestone.py b/github/Milestone.py index db38437f..0f23eb78 100644 --- a/github/Milestone.py +++ b/github/Milestone.py @@ -136,6 +136,7 @@ class Milestone(github.GithubObject.CompletableGithubObject): "DELETE", self.url, None, + None, None ) @@ -165,6 +166,7 @@ class Milestone(github.GithubObject.CompletableGithubObject): "PATCH", self.url, None, + None, post_parameters ) self._useAttributes(data) diff --git a/github/NamedUser.py b/github/NamedUser.py index ca29d38e..435b1bf2 100644 --- a/github/NamedUser.py +++ b/github/NamedUser.py @@ -270,6 +270,7 @@ class NamedUser(github.GithubObject.CompletableGithubObject): "POST", self.url + "/gists", None, + None, post_parameters ) return github.Gist.Gist(self._requester, headers, data, completed=True) @@ -393,6 +394,7 @@ class NamedUser(github.GithubObject.CompletableGithubObject): "GET", "/repos/" + self.login + "/" + name, None, + None, None ) return github.Repository.Repository(self._requester, headers, data, completed=True) @@ -461,6 +463,7 @@ class NamedUser(github.GithubObject.CompletableGithubObject): "GET", self.url + "/following/" + following._identity, None, + None, None ) return status == 204 diff --git a/github/Organization.py b/github/Organization.py index d252a054..aa904fce 100644 --- a/github/Organization.py +++ b/github/Organization.py @@ -246,6 +246,7 @@ class Organization(github.GithubObject.CompletableGithubObject): "PUT", self.url + "/public_members/" + public_member._identity, None, + None, None ) @@ -263,6 +264,7 @@ class Organization(github.GithubObject.CompletableGithubObject): "POST", "/repos/" + repo.owner.login + "/" + repo.name + "/forks", url_parameters, + None, None ) return github.Repository.Repository(self._requester, headers, data, completed=True) @@ -317,6 +319,7 @@ class Organization(github.GithubObject.CompletableGithubObject): "POST", self.url + "/repos", None, + None, post_parameters ) return github.Repository.Repository(self._requester, headers, data, completed=True) @@ -343,6 +346,7 @@ class Organization(github.GithubObject.CompletableGithubObject): "POST", self.url + "/teams", None, + None, post_parameters ) return github.Team.Team(self._requester, headers, data, completed=True) @@ -381,6 +385,7 @@ class Organization(github.GithubObject.CompletableGithubObject): "PATCH", self.url, None, + None, post_parameters ) self._useAttributes(data) @@ -470,6 +475,7 @@ class Organization(github.GithubObject.CompletableGithubObject): "GET", "/repos/" + self.login + "/" + name, None, + None, None ) return github.Repository.Repository(self._requester, headers, data, completed=True) @@ -502,6 +508,7 @@ class Organization(github.GithubObject.CompletableGithubObject): "GET", "/teams/" + str(id), None, + None, None ) return github.Team.Team(self._requester, headers, data, completed=True) @@ -529,6 +536,7 @@ class Organization(github.GithubObject.CompletableGithubObject): "GET", self.url + "/members/" + member._identity, None, + None, None ) return status == 204 @@ -544,6 +552,7 @@ class Organization(github.GithubObject.CompletableGithubObject): "GET", self.url + "/public_members/" + public_member._identity, None, + None, None ) return status == 204 @@ -559,6 +568,7 @@ class Organization(github.GithubObject.CompletableGithubObject): "DELETE", self.url + "/members/" + member._identity, None, + None, None ) @@ -573,6 +583,7 @@ class Organization(github.GithubObject.CompletableGithubObject): "DELETE", self.url + "/public_members/" + public_member._identity, None, + None, None ) diff --git a/github/PaginatedList.py b/github/PaginatedList.py index e450dfd8..45b2546d 100644 --- a/github/PaginatedList.py +++ b/github/PaginatedList.py @@ -119,7 +119,13 @@ class PaginatedList(PaginatedListBase): self._reversed = False def _getLastPageUrl(self): - headers, data = self.__requester.requestJsonAndCheck("GET", self.__firstUrl, self.__nextParams, None) + headers, data = self.__requester.requestJsonAndCheck( + "GET", + self.__firstUrl, + self.__nextParams, + None, + None + ) links = self.__parseLinkHeader(headers) lastUrl = links.get("last") return lastUrl @@ -140,7 +146,13 @@ class PaginatedList(PaginatedListBase): return self.__nextUrl is not None def _fetchNextPage(self): - headers, data = self.__requester.requestJsonAndCheck("GET", self.__nextUrl, self.__nextParams, None) + headers, data = self.__requester.requestJsonAndCheck( + "GET", + self.__nextUrl, + self.__nextParams, + None, + None + ) self.__nextUrl = None if len(data) > 0: @@ -177,7 +189,13 @@ class PaginatedList(PaginatedListBase): params["page"] = page + 1 if self.__requester.per_page != 30: params["per_page"] = self.__requester.per_page - headers, data = self.__requester.requestJsonAndCheck("GET", self.__firstUrl, params, None) + headers, data = self.__requester.requestJsonAndCheck( + "GET", + self.__firstUrl, + params, + None, + None + ) return [ self.__contentClass(self.__requester, headers, element, completed=False) diff --git a/github/PullRequest.py b/github/PullRequest.py index 8ea72e55..2b9b022b 100644 --- a/github/PullRequest.py +++ b/github/PullRequest.py @@ -293,6 +293,7 @@ class PullRequest(github.GithubObject.CompletableGithubObject): "POST", self.url + "/comments", None, + None, post_parameters ) return github.PullRequestComment.PullRequestComment(self._requester, headers, data, completed=True) @@ -311,6 +312,7 @@ class PullRequest(github.GithubObject.CompletableGithubObject): "POST", self._parentUrl(self._parentUrl(self.url)) + "/issues/" + str(self.number) + "/comments", None, + None, post_parameters ) return github.IssueComment.IssueComment(self._requester, headers, data, completed=True) @@ -337,6 +339,7 @@ class PullRequest(github.GithubObject.CompletableGithubObject): "PATCH", self.url, None, + None, post_parameters ) self._useAttributes(data) @@ -360,6 +363,7 @@ class PullRequest(github.GithubObject.CompletableGithubObject): "GET", self._parentUrl(self.url) + "/comments/" + str(id), None, + None, None ) return github.PullRequestComment.PullRequestComment(self._requester, headers, data, completed=True) @@ -418,6 +422,7 @@ class PullRequest(github.GithubObject.CompletableGithubObject): "GET", self._parentUrl(self._parentUrl(self.url)) + "/issues/comments/" + str(id), None, + None, None ) return github.IssueComment.IssueComment(self._requester, headers, data, completed=True) @@ -443,6 +448,7 @@ class PullRequest(github.GithubObject.CompletableGithubObject): "GET", self.url + "/merge", None, + None, None ) return status == 204 @@ -461,6 +467,7 @@ class PullRequest(github.GithubObject.CompletableGithubObject): "PUT", self.url + "/merge", None, + None, post_parameters ) return github.PullRequestMergeStatus.PullRequestMergeStatus(self._requester, headers, data, completed=True) diff --git a/github/PullRequestComment.py b/github/PullRequestComment.py index efc520cf..4d250d56 100644 --- a/github/PullRequestComment.py +++ b/github/PullRequestComment.py @@ -141,6 +141,7 @@ class PullRequestComment(github.GithubObject.CompletableGithubObject): "DELETE", self.url, None, + None, None ) @@ -158,6 +159,7 @@ class PullRequestComment(github.GithubObject.CompletableGithubObject): "PATCH", self.url, None, + None, post_parameters ) self._useAttributes(data) diff --git a/github/Repository.py b/github/Repository.py index ed5934d5..9a62e13d 100644 --- a/github/Repository.py +++ b/github/Repository.py @@ -319,6 +319,7 @@ class Repository(github.GithubObject.CompletableGithubObject): "PUT", self.url + "/collaborators/" + collaborator._identity, None, + None, None ) @@ -335,6 +336,7 @@ class Repository(github.GithubObject.CompletableGithubObject): "GET", self.url + "/compare/" + base + "..." + head, None, + None, None ) return github.Comparison.Comparison(self._requester, headers, data, completed=True) @@ -364,6 +366,7 @@ class Repository(github.GithubObject.CompletableGithubObject): "POST", self.url + "/downloads", None, + None, post_parameters ) return github.Download.Download(self._requester, headers, data, completed=True) @@ -385,6 +388,7 @@ class Repository(github.GithubObject.CompletableGithubObject): "POST", self.url + "/git/blobs", None, + None, post_parameters ) return github.GitBlob.GitBlob(self._requester, headers, data, completed=True) @@ -417,6 +421,7 @@ class Repository(github.GithubObject.CompletableGithubObject): "POST", self.url + "/git/commits", None, + None, post_parameters ) return github.GitCommit.GitCommit(self._requester, headers, data, completed=True) @@ -438,6 +443,7 @@ class Repository(github.GithubObject.CompletableGithubObject): "POST", self.url + "/git/refs", None, + None, post_parameters ) return github.GitRef.GitRef(self._requester, headers, data, completed=True) @@ -469,6 +475,7 @@ class Repository(github.GithubObject.CompletableGithubObject): "POST", self.url + "/git/tags", None, + None, post_parameters ) return github.GitTag.GitTag(self._requester, headers, data, completed=True) @@ -491,6 +498,7 @@ class Repository(github.GithubObject.CompletableGithubObject): "POST", self.url + "/git/trees", None, + None, post_parameters ) return github.GitTree.GitTree(self._requester, headers, data, completed=True) @@ -520,6 +528,7 @@ class Repository(github.GithubObject.CompletableGithubObject): "POST", self.url + "/hooks", None, + None, post_parameters ) return github.Hook.Hook(self._requester, headers, data, completed=True) @@ -554,6 +563,7 @@ class Repository(github.GithubObject.CompletableGithubObject): "POST", self.url + "/issues", None, + None, post_parameters ) return github.Issue.Issue(self._requester, headers, data, completed=True) @@ -575,6 +585,7 @@ class Repository(github.GithubObject.CompletableGithubObject): "POST", self.url + "/keys", None, + None, post_parameters ) return github.RepositoryKey.RepositoryKey(self._requester, headers, data, completed=True, repoUrl=self._url) @@ -596,6 +607,7 @@ class Repository(github.GithubObject.CompletableGithubObject): "POST", self.url + "/labels", None, + None, post_parameters ) return github.Label.Label(self._requester, headers, data, completed=True) @@ -626,6 +638,7 @@ class Repository(github.GithubObject.CompletableGithubObject): "POST", self.url + "/milestones", None, + None, post_parameters ) return github.Milestone.Milestone(self._requester, headers, data, completed=True) @@ -664,6 +677,7 @@ class Repository(github.GithubObject.CompletableGithubObject): "POST", self.url + "/pulls", None, + None, post_parameters ) return github.PullRequest.PullRequest(self._requester, headers, data, completed=True) @@ -677,6 +691,7 @@ class Repository(github.GithubObject.CompletableGithubObject): "DELETE", self.url, None, + None, None ) @@ -722,6 +737,7 @@ class Repository(github.GithubObject.CompletableGithubObject): "PATCH", self.url, None, + None, post_parameters ) self._useAttributes(data) @@ -742,6 +758,7 @@ class Repository(github.GithubObject.CompletableGithubObject): "GET", url, None, + None, None ) return headers["location"] @@ -769,6 +786,7 @@ class Repository(github.GithubObject.CompletableGithubObject): "GET", self.url + "/branches/" + branch, None, + None, None ) return github.Branch.Branch(self._requester, headers, data, completed=True) @@ -808,6 +826,7 @@ class Repository(github.GithubObject.CompletableGithubObject): "GET", self.url + "/comments/" + str(id), None, + None, None ) return github.CommitComment.CommitComment(self._requester, headers, data, completed=True) @@ -835,6 +854,7 @@ class Repository(github.GithubObject.CompletableGithubObject): "GET", self.url + "/commits/" + sha, None, + None, None ) return github.Commit.Commit(self._requester, headers, data, completed=True) @@ -893,6 +913,7 @@ class Repository(github.GithubObject.CompletableGithubObject): "GET", self.url + "/contents" + path, url_parameters, + None, None ) return github.ContentFile.ContentFile(self._requester, headers, data, completed=True) @@ -913,6 +934,7 @@ class Repository(github.GithubObject.CompletableGithubObject): "GET", self.url + "/contents" + path, url_parameters, + None, None ) @@ -922,6 +944,7 @@ class Repository(github.GithubObject.CompletableGithubObject): "GET", headers['location'], url_parameters, + None, None ) @@ -953,6 +976,7 @@ class Repository(github.GithubObject.CompletableGithubObject): "GET", self.url + "/downloads/" + str(id), None, + None, None ) return github.Download.Download(self._requester, headers, data, completed=True) @@ -1004,6 +1028,7 @@ class Repository(github.GithubObject.CompletableGithubObject): "GET", self.url + "/git/blobs/" + sha, None, + None, None ) return github.GitBlob.GitBlob(self._requester, headers, data, completed=True) @@ -1019,6 +1044,7 @@ class Repository(github.GithubObject.CompletableGithubObject): "GET", self.url + "/git/commits/" + sha, None, + None, None ) return github.GitCommit.GitCommit(self._requester, headers, data, completed=True) @@ -1037,6 +1063,7 @@ class Repository(github.GithubObject.CompletableGithubObject): "GET", self.url + prefix + ref, None, + None, None ) return github.GitRef.GitRef(self._requester, headers, data, completed=True) @@ -1064,6 +1091,7 @@ class Repository(github.GithubObject.CompletableGithubObject): "GET", self.url + "/git/tags/" + sha, None, + None, None ) return github.GitTag.GitTag(self._requester, headers, data, completed=True) @@ -1084,6 +1112,7 @@ class Repository(github.GithubObject.CompletableGithubObject): "GET", self.url + "/git/trees/" + sha, url_parameters, + None, None ) return github.GitTree.GitTree(self._requester, headers, data, completed=True) @@ -1099,6 +1128,7 @@ class Repository(github.GithubObject.CompletableGithubObject): "GET", self.url + "/hooks/" + str(id), None, + None, None ) return github.Hook.Hook(self._requester, headers, data, completed=True) @@ -1126,6 +1156,7 @@ class Repository(github.GithubObject.CompletableGithubObject): "GET", self.url + "/issues/" + str(number), None, + None, None ) return github.Issue.Issue(self._requester, headers, data, completed=True) @@ -1217,6 +1248,7 @@ class Repository(github.GithubObject.CompletableGithubObject): "GET", self.url + "/issues/events/" + str(id), None, + None, None ) return github.IssueEvent.IssueEvent(self._requester, headers, data, completed=True) @@ -1244,6 +1276,7 @@ class Repository(github.GithubObject.CompletableGithubObject): "GET", self.url + "/keys/" + str(id), None, + None, None ) return github.RepositoryKey.RepositoryKey(self._requester, headers, data, completed=True, repoUrl=self._url) @@ -1271,6 +1304,7 @@ class Repository(github.GithubObject.CompletableGithubObject): "GET", self.url + "/labels/" + urllib.quote(name), None, + None, None ) return github.Label.Label(self._requester, headers, data, completed=True) @@ -1296,6 +1330,7 @@ class Repository(github.GithubObject.CompletableGithubObject): "GET", self.url + "/languages", None, + None, None ) return data @@ -1311,6 +1346,7 @@ class Repository(github.GithubObject.CompletableGithubObject): "GET", self.url + "/milestones/" + str(number), None, + None, None ) return github.Milestone.Milestone(self._requester, headers, data, completed=True) @@ -1363,6 +1399,7 @@ class Repository(github.GithubObject.CompletableGithubObject): "GET", self.url + "/pulls/" + str(number), None, + None, None ) return github.PullRequest.PullRequest(self._requester, headers, data, completed=True) @@ -1433,6 +1470,7 @@ class Repository(github.GithubObject.CompletableGithubObject): "GET", self.url + "/readme", url_parameters, + None, None ) return github.ContentFile.ContentFile(self._requester, headers, data, completed=True) @@ -1508,6 +1546,7 @@ class Repository(github.GithubObject.CompletableGithubObject): "GET", self.url + "/assignees/" + assignee._identity, None, + None, None ) return status == 204 @@ -1523,6 +1562,7 @@ class Repository(github.GithubObject.CompletableGithubObject): "GET", self.url + "/collaborators/" + collaborator._identity, None, + None, None ) return status == 204 @@ -1540,6 +1580,7 @@ class Repository(github.GithubObject.CompletableGithubObject): "GET", "/legacy/issues/search/" + self.owner.login + "/" + self.name + "/" + state + "/" + urllib.quote(keyword), None, + None, None ) return [ @@ -1568,6 +1609,7 @@ class Repository(github.GithubObject.CompletableGithubObject): "POST", self.url + "/merges", None, + None, post_parameters ) if data is None: @@ -1586,6 +1628,7 @@ class Repository(github.GithubObject.CompletableGithubObject): "DELETE", self.url + "/collaborators/" + collaborator._identity, None, + None, None ) @@ -1627,6 +1670,7 @@ class Repository(github.GithubObject.CompletableGithubObject): "POST", "/hub", None, + None, post_parameters, ) diff --git a/github/RepositoryKey.py b/github/RepositoryKey.py index 074985d8..22b59621 100644 --- a/github/RepositoryKey.py +++ b/github/RepositoryKey.py @@ -91,6 +91,7 @@ class RepositoryKey(github.GithubObject.CompletableGithubObject): "DELETE", self.__customUrl, None, + None, None ) @@ -112,6 +113,7 @@ class RepositoryKey(github.GithubObject.CompletableGithubObject): "PATCH", self.__customUrl, None, + None, post_parameters ) self._useAttributes(data) diff --git a/github/Requester.py b/github/Requester.py index feed86b2..b161de13 100644 --- a/github/Requester.py +++ b/github/Requester.py @@ -168,11 +168,11 @@ class Requester: 'See http://developer.github.com/v3/#user-agent-required' self.__userAgent = user_agent - def requestJsonAndCheck(self, verb, url, parameters, input): - return self.__check(*self.requestJson(verb, url, parameters, input)) + def requestJsonAndCheck(self, verb, url, parameters, headers, input): + return self.__check(*self.requestJson(verb, url, parameters, headers, input)) - def requestMultipartAndCheck(self, verb, url, parameters, input): - return self.__check(*self.requestMultipart(verb, url, parameters, input)) + def requestMultipartAndCheck(self, verb, url, parameters, headers, input): + return self.__check(*self.requestMultipart(verb, url, parameters, headers, input)) def __check(self, status, responseHeaders, output): output = self.__structuredFromJson(output) @@ -208,13 +208,13 @@ class Requester: except ValueError, e: return {'data': data} - def requestJson(self, verb, url, parameters, input): + def requestJson(self, verb, url, parameters, headers, input): def encode(input): return "application/json", json.dumps(input) - return self.__requestEncode(verb, url, parameters, input, encode) + return self.__requestEncode(verb, url, parameters, headers, input, encode) - def requestMultipart(self, verb, url, parameters, input): + def requestMultipart(self, verb, url, parameters, headers, input): def encode(input): boundary = "----------------------------3c3ba8b523b2" eol = "\r\n" @@ -228,16 +228,16 @@ class Requester: encoded_input += "--" + boundary + "--" + eol return "multipart/form-data; boundary=" + boundary, encoded_input - return self.__requestEncode(verb, url, parameters, input, encode) + return self.__requestEncode(verb, url, parameters, headers, input, encode) - def __requestEncode(self, verb, url, parameters, input, encode): + def __requestEncode(self, verb, url, parameters, requestHeaders, input, encode): assert verb in ["HEAD", "GET", "POST", "PATCH", "PUT", "DELETE"] if parameters is None: parameters = dict() + if requestHeaders is None: + requestHeaders = dict() - requestHeaders = dict() self.__authenticate(url, requestHeaders, parameters) - self.__conditional(requestHeaders, parameters) requestHeaders["User-Agent"] = self.__userAgent url = self.__makeAbsoluteUrl(url) @@ -288,18 +288,6 @@ class Requester: if self.__authorizationHeader is not None: requestHeaders["Authorization"] = self.__authorizationHeader - def __conditional(self, requestHeaders, parameters): - # #193: Why pass etag and last_modified by param "parameters"? - # #193: May be better to add a specific param "headers" to methods requestFoobar? - etag = parameters.get(Consts.REQ_IF_NONE_MATCH) - last_modified = parameters.get(Consts.REQ_IF_MODIFIED_SINCE) - if etag is not None: - requestHeaders[Consts.REQ_IF_NONE_MATCH] = etag - del parameters[Consts.REQ_IF_NONE_MATCH] - if last_modified is not None: - requestHeaders[Consts.REQ_IF_MODIFIED_SINCE] = last_modified - del parameters[Consts.REQ_IF_MODIFIED_SINCE] - def __makeAbsoluteUrl(self, url): # URLs generated locally will be relative to __base_url # URLs returned from the server will start with __base_url diff --git a/github/Team.py b/github/Team.py index 804ed3ab..d8fb7379 100644 --- a/github/Team.py +++ b/github/Team.py @@ -96,6 +96,7 @@ class Team(github.GithubObject.CompletableGithubObject): "PUT", self.url + "/members/" + member._identity, None, + None, None ) @@ -110,6 +111,7 @@ class Team(github.GithubObject.CompletableGithubObject): "PUT", self.url + "/repos/" + repo._identity, None, + None, None ) @@ -122,6 +124,7 @@ class Team(github.GithubObject.CompletableGithubObject): "DELETE", self.url, None, + None, None ) @@ -143,6 +146,7 @@ class Team(github.GithubObject.CompletableGithubObject): "PATCH", self.url, None, + None, post_parameters ) self._useAttributes(data) @@ -182,6 +186,7 @@ class Team(github.GithubObject.CompletableGithubObject): "GET", self.url + "/members/" + member._identity, None, + None, None ) return status == 204 @@ -197,6 +202,7 @@ class Team(github.GithubObject.CompletableGithubObject): "GET", self.url + "/repos/" + repo._identity, None, + None, None ) return status == 204 @@ -212,6 +218,7 @@ class Team(github.GithubObject.CompletableGithubObject): "DELETE", self.url + "/members/" + member._identity, None, + None, None ) @@ -226,6 +233,7 @@ class Team(github.GithubObject.CompletableGithubObject): "DELETE", self.url + "/repos/" + repo._identity, None, + None, None ) diff --git a/github/UserKey.py b/github/UserKey.py index 44cc5808..83a26009 100644 --- a/github/UserKey.py +++ b/github/UserKey.py @@ -82,6 +82,7 @@ class UserKey(github.GithubObject.CompletableGithubObject): "DELETE", self.url, None, + None, None ) @@ -103,6 +104,7 @@ class UserKey(github.GithubObject.CompletableGithubObject): "PATCH", self.url, None, + None, post_parameters ) self._useAttributes(data)