0

有谁知道 Smartsheet SDK 是否与亚马逊的 AWS Lambda 兼容?我有一张 Smartsheet 的票,但还没有收到他们的消息,所以我想我会在这里尝试一下。

在 AWS“ sheet = smartsheet.sheets.get(SHEET_ID) ”上运行此命令时,我遇到了超时。

AWS Lambda 错误消息:

{
  "errorMessage": "2021-02-19T18:33:11.477Z cbad2464-4195-4a54-ac72-ea53c2786b75 Task timed out after 10.01 seconds"
}

谢谢!

Python(3.8版)代码:

  # Name of the Smartsheet being updated
  SHEET_ID = "CENIC Circuit Master Sheet Current"

  smartsheet = Smartsheet(TOKEN)
#  print("DeBug 3 sheet = ", smartsheet) 
  # This is the problem below.
  **sheet = smartsheet.sheets.get(SHEET_ID)**
  # Make sure we don't miss any errors
  smartsheet_client.errors_as_exceptions(True)

在 Ubuntu 最新版本上运行良好。

4

1 回答 1

0

您正在使用无效的语句。Sheets(大写“S”)需要数字工作表 ID,而不是工作表名称。有关详细信息,请参阅文档。这就是发生错误的原因。

sheet = smartsheet.Sheets.get_sheet(4583173393803140)  

为什么超时错误?

errors_as_exceptions您在拨打电话后启用。所以你没有从错误中得到有用的信息。将您的代码修改为如下所示:

smartsheet.errors_as_exceptions(True)

SHEET_ID = 4583173393803140  # You must retrieve the Sheet ID first, names are not allowed
try:
    sheet = smartsheet.Sheets.get_sheet(sheet_ID)
    print(sheet)
except Exception as e: 
    print(e.message)
于 2021-02-28T04:13:36.107 回答