I’m having trouble getting worklog information using the python-jira package. When I try to fetch worklogs from an issue, I keep running into an AttributeError.
Here’s what I’m attempting:
tickets = jira_client.search_issues("key=PROJECT-123")
print(tickets[0].fields.worklogs)
single_ticket = jira_client.issue("PROJECT-123")
print(single_ticket.fields.worklogs)
Both approaches give me this error message:
AttributeError: type object 'PropertyHolder' has no attribute 'worklogs'
I followed the examples from the official docs but it’s not working as expected. Am I missing something in my implementation? Could this be a version compatibility issue? Also, what exactly is this PropertyHolder object that keeps appearing in the error? I need to access both worklogs and comments from JIRA issues but can’t seem to get past this error.
Indeed, the occurrence of PropertyHolder is common with JIRA’s Python library due to its implementation of lazy loading. Essentially, PropertyHolder acts as a placeholder for data that hasn’t yet been fetched. While the suggested solution regarding the expand parameter should resolve the issue in many cases, it’s crucial to also consider permissions. Certain JIRA configurations may restrict access to worklogs on a per-project or per-issue basis. Even with proper use of the expand parameter, if your user account lacks the necessary permissions, you may continue to encounter PropertyHolder. Furthermore, version discrepancies in python-jira can lead to variations in field naming, so it’s wise to consult the documentation pertinent to the version you are using rather than relying solely on the latest examples.
yeah, ran into this same issue when i started using jira’s api. propertyholder is just an empty placeholder that shows up when the field isnt loaded. ryans spot on about the expand param, but also check ur jira permissions - u’ll still get propertyholder even with expand if u dont have worklog view rights for that project.
The PropertyHolder error means your query isn’t pulling worklog data. JIRA’s REST API doesn’t include worklogs in standard searches by default - it’d kill performance. You’ve got to explicitly request it with the expand parameter.
Try this:
tickets = jira_client.search_issues("key=PROJECT-123", expand="worklog")
print(tickets[0].fields.worklog.worklogs)
single_ticket = jira_client.issue("PROJECT-123", expand="worklog")
print(single_ticket.fields.worklog.worklogs)
Important: it’s worklog.worklogs, not just worklogs. The worklog field has a worklogs array plus metadata like maxResults and total count. Ran into this exact issue building reporting tools - tons of fields need explicit expansion to work with python-jira.
This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.