Reputation: 29
My Desktop is Debian 8.5 running firefox and running Mozilla Firefox 45.3 and SmartSheet latest version. Lately I have been trying to obtain attributes from a sheet, among them createdAt or modifiedAt, but when I run the code below:
import smartsheet
planilha = smartsheet.Smartsheet(MyToken)
action = planilha.Sheets.list_sheets(include_all=True) sheets = action.data
xCount=0
for row in sheets: xCount+=1 print row.id, row.createdAt print xCount
I get
....... print row.id, row.createdAt File "/usr/local/lib/python2.7/dist-packages/smartsheet/models/sheet.py", line 175, in getattr raise AttributeError(key) AttributeError: createdAt ......
I just wonder why or I certainly miss something in Smartsheet API 2.0 docs.. thanks in advance
Upvotes: 0
Views: 233
Reputation: 13480
Any attributes described in the Smartsheet API documentation (which do not specifically appear in a Python code example) represent how the attributes appear in the raw API (JSON) requests/responses. The Python SDK itself actually uses Python variable naming conventions: "lowercase with words separated by underscores as necessary to improve readability" (as described here: python.org/dev/peps/pep-0008). So, for example, the raw API response may contain the attribute "modifiedAt" -- but when using this attribute via the Python SDK, you'll refer to it as "modified_at".
So, try using created_at and modified_at (instead of createdAt and modifiedAt).
Upvotes: 0