(self, user, repo, type="all")
| 103 | self.headers["Authorization"] = "Basic " + authstr |
| 104 | |
| 105 | def pulls(self, user, repo, type="all"): |
| 106 | page = 1 |
| 107 | ret = [] |
| 108 | while True: |
| 109 | url = f"https://api.github.com/repos/{user}/{repo}/pulls?state={type}&page={page}" |
| 110 | req = urllib.request.Request(url, None, self.headers) |
| 111 | result = urllib.request.urlopen(req) |
| 112 | contents = result.read().decode() |
| 113 | if result.getcode() != 200: |
| 114 | raise Exception(result.getcode() + " != 200 " + contents) |
| 115 | got = json.loads(contents) |
| 116 | for part in got: |
| 117 | ret.append(GitPullRequest(part, self)) |
| 118 | if len(got) == 0: |
| 119 | return ret |
| 120 | page = page + 1 |
| 121 | |
| 122 | def open_pulls(self, user, repo): |
| 123 | return self.pulls(user, repo, "open") |
no test coverage detected