python-redmine timestamp filter -
i have code in python use retrieve issues redmine project.
using python-redmine library.
code below:
from redminelib import redmine datetime import datetime datetime import timedelta time = datetime.now() checktime = time -timedelta(minutes = 5) redmine = redmine('*redmine url*',key = '*admin key*') issues = redmine.issue.filter(project_id = "*project*", status_id = "1", created_on = '>=%s'%checktime.strftime('%y-%m-%dt%h:%m:%sz')) issue in issues: *rest of code*
the requirement fetch redmine issues created in last 5 minutes. no record being fetched in above code.
if use:
issues = redmine.issue.filter(project_id = "*project*", status_id = "1", created_on = '>=%s'%checktime.strftime('%y-%m-%d'))
records being fetched - albeit whole day.
could point out incorrect in time filter preventing redmine records being retrieved.
the datetime format in redmine instance 2017-08-18 16:31:04
you can filter using datetime in redmine 2.5 or higher:
http://www.redmine.org/issues/8842
you might want verify version of redmine using. tried code works redmine 3.3.1 not 1.0.1
Comments
Post a Comment