Jan Soubusta
Jan Soubusta

Reputation: 31

Github API - how to get pull requests newer than some date

Corresponding to the official DOC, I prepare the following URL: https://api.github.com/repos/gooddata/gooddata-python-sdk/pulls?per_page=10&page=1&sort=updated&direction=asc&state=all&q=updated:%3E=2022-06-01

It returns the first 10 pull requests in this (public) repo, first with updated at 2021-08-05T12:55:43Z. It seems that the following part of the query does not work: &q=updated:%3E=2022-06-01

I tried to utilize the existing python library for integration with Github API: https://github.com/PyGithub/PyGithub, but there is no support for limiting the updated field.

Upvotes: 3

Views: 2504

Answers (1)

Leslie Alldridge
Leslie Alldridge

Reputation: 1583

I think with PyGitHub my approach would be to get all open PRs, sort by updated in ascending/descending order whichever you prefer.

In this example https://pygithub.readthedocs.io/en/latest/examples/PullRequest.html?highlight=pr#get-pull-requests-by-query

I'd change sort="updated" and direction="desc" so:

repo.get_pulls(state="open", sort="updated", direction="desc")

I'm unfamiliar with gooddata so cannot help there sorry.

Upvotes: 0

Related Questions