You are iterating over the keys, not the values.
D'oh!!! Yep, you're right. The reason I didn't catch that sooner, is that the return from the first debug statement return({'json': resource})
didn't look like a key:
{u'projectName': u'v7_staging_tool_backup',
u'resourcePath': {u'path': {u'parts': [u'Main Window (1)']},
u'resourceType': {u'moduleId': u'com.inductiveautomation.vision',
u'typeId': u'windows'}}}
What’s the output from the dir
line?
And this looked close enough to what I was expecting as well. Output of dir(resource)
(with private attr's hidden):
[u'class',
u'equals',
u'folderPath',
u'fromJson',
u'getClass',
u'getFolderPath',
u'getProjectName',
u'getResourcePath',
u'getResourceType',
u'hashCode',
u'notify',
u'notifyAll',
u'projectName',
u'resourcePath',
u'resourceType',
u'toJson',
u'toString',
u'wait']
In any case, changing for resource in resources:
to for resourceId, resource in resources.items():
fixed my problem, and I am able to get the lastModification
attribute now. Thanks for pointing me in the right direction on my iterator!