python - 通过 Python 下载 Smartsheet 附件
问题描述
我正在使用 simple-smartsheet 库从 Smartsheet 中的工作表中读取数据,并在工作表的每一行下载现有附件。
我已经可以读取每一行的数据,但是我无法下载现有附件。
import config
from simple_smartsheet import Smartsheet
sheet = smartsheet.sheets.get(id=config.SHEET_ID)
for row in sheet.rows:
attachments = row.attachments
print(attachments)
执行上述命令时,我得到结果:
[]
我使用 simple-smartsheet 库,因为它是唯一支持 python 3.6+ 版本的库
我的 python 版本 3.7.5
解决方案
看起来该库尚未实现处理附件的逻辑。
作为解决此问题的替代方法,我使用以下代码实现了一个解决方案:
import requests
#token = 'Your smartsheet Token'
#sheetId = 'Your sheet id'
r = requests.get('https://api.smartsheet.com/2.0/sheets/{sheetId}/rows/{rowId}/attachments', headers={'Authorization': f'Bearer {token}'})
response_json = r.json()
print(response_json)
有关处理附件 Smartsheets 的更多详细信息,请参阅获取附件
推荐阅读
- javascript - 如何使用 gsap 和 javascript 切换标题?
- java - 为什么没有 RequestMappingHandlerMapping 类型的合格 bean?
- javascript - javascript:具有大量空值的二维数组 VS 使用索引的对象数组
- azure - 将 Microsoft Dynamics 导出到 Azure SQL 超大规模
- python - PYTHON + KIVYMD / KIVY | 滚动视图仅在屏幕的一半上,但在导航抽屉中使用时正常工作
- javascript - 为什么此功能不在每个画布上粘贴一个图像?
- html - 尝试重新创建此模板,但菜单无法正常工作?
- java - 云中的 Spring Boot API 不如本地快
- java - 如何使用 Mockito 模拟局部变量?
- json - 无法访问键中包含连字符或数字的 JSON 属性 - Rollup 和 TypeScript