I want to do something like below piece of code :- want to iterate for number of worklogs entries for particular value.key
I want to get details logged by user on daily basis and details should be of last nine weeks.
Could you please suggest and check my code that I am going in right direction or not.
example :-
Key worklogtime logged_date logged_by
203 2h 2018-04-08 xyz
203 1h 2018-04-07 abc
201 4h 2018-04-07 blaah
Piece of Code:-
import jira.client
from jira.client import JIRA
options = {'server': 'https:/example.com', 'verify':False}
jira = JIRA(options, basic_auth=('user', 'password))
issues_in_project = jira.search_issues('project=11372 and Assignee in(xyz,abc)',maxResults=1000)
i = 0
for value in issues_in_project:
for i in value:
print value.fields.worklog.worklogs[i].timeSpent, value.fields.worklog.worklogs[i].updated,value.fields.worklog.worklogs[i].updateAuthor,value.key
i = i + 1
Got error :-
Traceback (most recent call last):
File "jira_test_Time_log.py", line 89, in <module>
for i in value:
TypeError: 'Issue' object is not iterable
But I was able to get results from below for 2 indexes:-
for value in issues_in_project:
print value.fields.worklog.worklogs[0].timeSpent, value.fields.worklog.worklogs[0].updated,value.fields.worklog.worklogs[0].updateAuthor,value.key
print value.fields.worklog.worklogs[1].timeSpent, value.fields.worklog.worklogs[1].updated,value.fields.worklog.worklogs[1].updateAuthor,value.key
Working code. Loop through all project, all issue and then all worklog.
Himanshu,
I added the code to the other question you raised, but I'll include here for visibility. You can iterate over the index with the following code.
for value in issues_in_project:
log_entry_count = len(value.fields.worklog.worklogs)
for i in range(log_entry_count):
print value.key, value.fields.worklog.worklogs[i].timeSpent, value.fields.worklog.worklogs[i].updated, value.fields.worklog.worklogs[i].updateAuthor
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.