2

I'm trying to use the row attribute created_by accessing it with the Python SDK and it keeps throwing an error. I'm not sure if I'm missing something.

Every time I try to use it I get the error:

  File "C:\Python27\lib\site-packages\smartsheet\models\row.py", line 166, in __getattr__  raise AttributeError(key)
  AttributeError: created_by

It also doesn't return anything when I run created_at, but at least it doesn't throw an error.

Anyone else have this problem, or at least can point me to what I'm doing wrong?

It happens ever time I call it. Here is a simple example

smartsheet = smartsheet.Smartsheet(SMARTSHEET_ACCESS_TOKEN)
sheet = smartsheet.Sheets.get_sheet(IT_TRACKER_ID)
rows = sheet.rows
columns = sheet.columns

print rows[1].created_by
JHWelch
  • 45
  • 6
  • Can you please update your question/post to include your code that is calling a function in the Python SDK and then trying to access the **created_by** attribute? Seeing the code that's producing the error you've described will allow folks to reproduce and troubleshoot the error. – Kim Brandl Sep 08 '16 at 00:48
  • I added a code sample. am I just using it incorrectly? Its in nothing complicated. – JHWelch Sep 08 '16 at 12:27

1 Answers1

0

Via the API, if you want the Get Sheet response to include the createdBy attribute for each Row, you must specify the include parameter on the request with a value that includes the string rowWriterInfo. (See the Row Include Flags section API docs for more info.) For example:

GET https://api.smartsheet.com/2.0/sheets/7359436428732292?include=rowWriterInfo

If I execute this request via Postman, I see that the response does indeed include the createdBy attribute for each Row object in the response.

Via the SDK, I can execute this same request as follows:

sheet = smartsheet.Sheets.get_sheet(7359436428732292, include='rowWriterInfo')

So, the SDK seems to be sending the request properly. However, it doesn't look like the SDK currently supports accessing the created_by property of Row objects -- if you search the Lib\site-packages\smartsheet\models\row.py file for created_by, you'll come up empty.

I'd suggest that you report this issue to Smartsheet by opening an issue in the corresponding GitHub repo. In the meantime, you might consider updating your local copy of the Python SDK to add support for accessing the created_by property of Row objects.

Kim Brandl
  • 13,125
  • 2
  • 16
  • 21
  • Great thanks! I looked in the row.py file and when I didn't see the created_by I thought I was missing something. I guess I'll have to write my own to fetch the created_by. Odd they don't have it, it seems like it could be a useful piece of information when writing scripts. – JHWelch Sep 09 '16 at 15:17