2

I'm trying to get a count of issues using PyGithub in a repository within a certain date range (the month). The date range is what I can't get right no matter what I've tried. Using the GitHub webui, this is the query I would use:

is:issue created:2019-10-01..2019-10-31 label:<label>

Using the code below gets me the issues and labels, but I can't get the date range to work. There's a since parameter for get_issues, but I can't get the range for the date to work.

Should I be doing this in a totally different manner?

repo = g.get_repo("someRepo")
label = repo.get_label('someLabel')
myIssues = repo.get_issues(labels=[label])
count = 0
for issue in myIssues:
    if not issue.pull_request:
       count = count + 1
print(count)
DBS
  • 1,107
  • 1
  • 12
  • 24
  • 1
    I don't think the API directly supports what you are trying to do. You might need to do the date filtering on the client side. – jordanm Jan 22 '20 at 19:59
  • Yep, I've figured it out using `datetime` and the `created_at` value returned for an issue. Thanks! – DBS Jan 23 '20 at 03:59

0 Answers0