forked from AFPy/potodo
Added pagination for issues API
This commit is contained in:
parent
2aaee0a7f6
commit
76783ca512
|
@ -36,12 +36,20 @@ def get_repo_name(repo_path: str) -> str:
|
|||
def get_reservation_list(repo_path: str) -> Mapping[str, str]:
|
||||
"""Will get the repository name then request all the issues and put them in a dict
|
||||
"""
|
||||
# Gets the issues into a dict
|
||||
issues = requests.get(
|
||||
"https://api.github.com/repos/" + get_repo_name(repo_path) + "/issues"
|
||||
).json()
|
||||
# Creates the issue dict with the name and the login
|
||||
reservations: dict = {
|
||||
issue["title"].split()[-1].lower(): issue["user"]["login"] for issue in issues
|
||||
}
|
||||
|
||||
issues: list = []
|
||||
next = "https://api.github.com/repos/" + get_repo_name() + "/issues?state=open"
|
||||
while next:
|
||||
resp = requests.get(next)
|
||||
issues += issues
|
||||
next = resp.links.get("next", {}).get("url")
|
||||
|
||||
reservations = {}
|
||||
|
||||
for issue in issues:
|
||||
# Maybe find a better way for not using python 3.8 ?
|
||||
if re.search(r'\w*/\w*\.po', issue['title']):
|
||||
yes = re.search(r'\w*/\w*\.po', issue['title'])
|
||||
reservations[yes.group()] = issue['user']['login']
|
||||
|
||||
return reservations
|
||||
|
|
Loading…
Reference in New Issue
Block a user