列表讨论功能有限的字符

你好,

我试图拉与表ID相关的所有讨论和评论。

我能够通过python使用API拉,如下所示。

然而,评论只有有限的字符,换句话说,我只能看到前100个字符。请建议


下面是Python代码

导入内容

进口熊猫作为pd


#设置访问令牌

SMARTSHEET_ACCESS_TOKEN = "xxxxxxxx"


#初始化客户端

smartsheet_client = smartsheet.Smartsheet(SMARTSHEET_ACCESS_TOKEN)


#设置Sheet_id

Sheet_id = XXXXXXXX

sheet = smartsheet_client.Sheets.get_sheet(sheet_id)

print("Loaded Sheet: " + Sheet .name)


#调用指定表的讨论

response = smartsheet_client. discussion .get_all_discussion (sheet_id,include_all=True)

讨论= response.data


#将讨论数据转换为字典格式

discussionsDict = response.to_dict()


#从讨论字典中创建一个注释数据框架

commentsdf = pd.DataFrame.from_dict(discussionsDict['data'])


#保存注释数据帧到csv文件

commentsdf.to_csv(“comments.csv”)


标签:

最佳答案

  • JKrombeenASK"class=
    ✓回答

    @telduzdar

    我认为您看到的不是评论,而是讨论标题,它是通过“复制顶级评论的前100个字符”创建的。(https://smartsheet.redoc.ly/#operation/discussions-list,响应,数据,标题)

    要将注释包含到数据响应中,您应该添加Include = 'comments'听您的召唤:

    response = smartsheet_client. discussion。get_all_discussions (sheet_id include_all = True,包括=“评论”)


    希望有帮助!

答案

In case anyone finds this thread, I posted this to stackoverflow and received this answer:<\/p>
\n \n https:\/\/stackoverflow.com\/a\/73194270\/6770704\n <\/a>\n<\/div>


<\/p>

Apparently in the OperationErrorResult class, there are a few errors which undergo an auto-retry:<\/p>

4003: {\n    'name': 'RateLimitExceededError',\n    'recommendation': ('Retry using exponential backoff. Hint: '\n                       'Reduce the rate at which you are sending '\n                       'requests.'),\n    'should_retry': True},\n<\/pre>

So the error is handled and the request is automatically retried.<\/p>


<\/p>

If anyone wishes for further details, please see the linked post to stackoverflow<\/p>"}]}},"status":{"statusID":3,"name":"Accepted","state":"closed","recordType":"discussion","recordSubType":"question","log":{"reasonUpdated":"","dateUpdated":"2022-08-02 11:49:33","updateUser":{"userID":150873,"name":"I_B","url":"https:\/\/community.smartsheet.com\/profile\/I_B","photoUrl":"https:\/\/us.v-cdn.net\/6031209\/uploads\/defaultavatar\/nWRMFRX6I99I6.jpg","dateLastActive":"2022-08-02T11:45:33+00:00","banned":0,"punished":0,"private":false,"label":"✭"}}},"bookmarked":false,"unread":false,"category":{"categoryID":320,"name":"API & Developers","url":"https:\/\/community.smartsheet.com\/categories\/api-developers","allowedDiscussionTypes":[]},"reactions":[{"tagID":3,"urlcode":"Promote","name":"Promote","class":"Positive","hasReacted":false,"reactionValue":5,"count":0},{"tagID":5,"urlcode":"Insightful","name":"Insightful","class":"Positive","hasReacted":false,"reactionValue":1,"count":0},{"tagID":11,"urlcode":"Up","name":"Vote Up","class":"Positive","hasReacted":false,"reactionValue":1,"count":0},{"tagID":13,"urlcode":"Awesome","name":"Awesome","class":"Positive","hasReacted":false,"reactionValue":1,"count":0}],"tags":[{"tagID":219,"urlcode":"Sheets","name":"Sheets"},{"tagID":227,"urlcode":"API Developers","name":"API and Developers"}]},{"discussionID":93567,"type":"question","name":"Is there a change log for the Smartsheet API Reference?","excerpt":"The Smartsheet API Reference shows that it was updated on 2022-07-13. Is there a way to see what changed?","categoryID":320,"dateInserted":"2022-07-25T17:55:57+00:00","dateUpdated":null,"dateLastComment":"2022-07-26T14:20:48+00:00","insertUserID":127476,"insertUser":{"userID":127476,"name":"Leibel Shuchat","title":"","url":"https:\/\/community.smartsheet.com\/profile\/Leibel%20Shuchat","photoUrl":"https:\/\/us.v-cdn.net\/6031209\/uploads\/defaultavatar\/nWRMFRX6I99I6.jpg","dateLastActive":"2022-08-04T14:11:48+00:00","banned":0,"punished":0,"private":false,"label":"✭✭✭✭✭"},"updateUserID":null,"lastUserID":127476,"lastUser":{"userID":127476,"name":"Leibel Shuchat","title":"","url":"https:\/\/community.smartsheet.com\/profile\/Leibel%20Shuchat","photoUrl":"https:\/\/us.v-cdn.net\/6031209\/uploads\/defaultavatar\/nWRMFRX6I99I6.jpg","dateLastActive":"2022-08-04T14:11:48+00:00","banned":0,"punished":0,"private":false,"label":"✭✭✭✭✭"},"pinned":false,"pinLocation":null,"closed":false,"sink":false,"countComments":2,"countViews":20,"score":null,"hot":3317618205,"url":"https:\/\/community.smartsheet.com\/discussion\/93567\/is-there-a-change-log-for-the-smartsheet-api-reference","canonicalUrl":"https:\/\/community.smartsheet.com\/discussion\/93567\/is-there-a-change-log-for-the-smartsheet-api-reference","format":"Rich","tagIDs":[227],"lastPost":{"discussionID":93567,"commentID":337455,"name":"Re: Is there a change log for the Smartsheet API Reference?","url":"https:\/\/community.smartsheet.com\/discussion\/comment\/337455#Comment_337455","dateInserted":"2022-07-26T14:20:48+00:00","insertUserID":127476,"insertUser":{"userID":127476,"name":"Leibel Shuchat","title":"","url":"https:\/\/community.smartsheet.com\/profile\/Leibel%20Shuchat","photoUrl":"https:\/\/us.v-cdn.net\/6031209\/uploads\/defaultavatar\/nWRMFRX6I99I6.jpg","dateLastActive":"2022-08-04T14:11:48+00:00","banned":0,"punished":0,"private":false,"label":"✭✭✭✭✭"}},"breadcrumbs":[{"name":"Home","url":"https:\/\/community.smartsheet.com\/"},{"name":"API & Developers","url":"https:\/\/community.smartsheet.com\/categories\/api-developers"}],"groupID":null,"statusID":3,"attributes":{"question":{"status":"accepted","dateAccepted":"2022-07-26T14:20:50+00:00","dateAnswered":"2022-07-26T12:18:44+00:00","acceptedAnswers":[{"commentID":337424,"body":"

Hi,<\/p>

I checked with and older version of the swagger documentation from the API reference: the changes are mostly typos.<\/p>

there are also some changes regarding the commenter level access on reports and notes about the US-GOV version of smartsheet.<\/p>"}]}},"status":{"statusID":3,"name":"Accepted","state":"closed","recordType":"discussion","recordSubType":"question","log":{"reasonUpdated":"","dateUpdated":"2022-07-26 14:20:50","updateUser":{"userID":127476,"name":"Leibel Shuchat","title":"","url":"https:\/\/community.smartsheet.com\/profile\/Leibel%20Shuchat","photoUrl":"https:\/\/us.v-cdn.net\/6031209\/uploads\/defaultavatar\/nWRMFRX6I99I6.jpg","dateLastActive":"2022-08-04T14:11:48+00:00","banned":0,"punished":0,"private":false,"label":"✭✭✭✭✭"}}},"bookmarked":false,"unread":false,"category":{"categoryID":320,"name":"API & Developers","url":"https:\/\/community.smartsheet.com\/categories\/api-developers","allowedDiscussionTypes":[]},"reactions":[{"tagID":3,"urlcode":"Promote","name":"Promote","class":"Positive","hasReacted":false,"reactionValue":5,"count":0},{"tagID":5,"urlcode":"Insightful","name":"Insightful","class":"Positive","hasReacted":false,"reactionValue":1,"count":0},{"tagID":11,"urlcode":"Up","name":"Vote Up","class":"Positive","hasReacted":false,"reactionValue":1,"count":0},{"tagID":13,"urlcode":"Awesome","name":"Awesome","class":"Positive","hasReacted":false,"reactionValue":1,"count":0}],"tags":[{"tagID":227,"urlcode":"API Developers","name":"API and Developers"}]},{"discussionID":92735,"type":"question","name":"Python get_columns response.","excerpt":"I am trying to find specific columns through the python api. Running something like listColumns = smartAPI.Sheets.get_columns(83053825###, include_all=True) gives me the object and not the Field Name. [, Hey @MikeG_O<\/a> <\/p>

It looks like you may just need to resolve the response (i.e. columns = listColumns.data<\/code>). Here's the API Documentation and example: List Columns<\/a><\/p>

Let me know if this has helped!<\/p>

Cheers,<\/p>

Genevieve<\/p>"}]}},"status":{"statusID":3,"name":"Accepted","state":"closed","recordType":"discussion","recordSubType":"question","log":{"reasonUpdated":"","dateUpdated":"2022-07-06 16:35:25","updateUser":{"userID":149319,"name":"MikeG_O","title":"","url":"https:\/\/community.smartsheet.com\/profile\/MikeG_O","photoUrl":"https:\/\/us.v-cdn.net\/6031209\/uploads\/defaultavatar\/nWRMFRX6I99I6.jpg","dateLastActive":"2022-07-19T16:04:38+00:00","banned":0,"punished":0,"private":false,"label":"✭"}}},"bookmarked":false,"unread":false,"category":{"categoryID":320,"name":"API & Developers","url":"https:\/\/community.smartsheet.com\/categories\/api-developers","allowedDiscussionTypes":[]},"reactions":[{"tagID":3,"urlcode":"Promote","name":"Promote","class":"Positive","hasReacted":false,"reactionValue":5,"count":0},{"tagID":5,"urlcode":"Insightful","name":"Insightful","class":"Positive","hasReacted":false,"reactionValue":1,"count":0},{"tagID":11,"urlcode":"Up","name":"Vote Up","class":"Positive","hasReacted":false,"reactionValue":1,"count":0},{"tagID":13,"urlcode":"Awesome","name":"Awesome","class":"Positive","hasReacted":false,"reactionValue":1,"count":0}],"tags":[]}],"title":"Trending in API & Developers","subtitle":null,"description":null,"noCheckboxes":true,"containerOptions":[],"discussionOptions":[]}">