写了一个Python测试脚本,读取CSV文件表头,然后创建一个新的Table。
看API教程使用 base.add_table() 方法,部分代码如下
预格式化文本将缩进 4 格
# 获取CSV文件表头
f_csv = csv.reader(fileObj)
headers = next(f_csv)
print(headers)
# 创建新数据表
respone = base.add_table(file_name, lang='zh-cn',columns=headers)
运行结果:
[‘vSEID’, ‘pSEID’, ‘ChipVendor’, ‘OSVersion’, ‘CPLC’]
Traceback (most recent call last):
File “E:/Project/PyProject/SeaTable/APItest/csv2table.py”, line 55, in
expand(csv_path, row_id)
File “E:/Project/PyProject/SeaTable/APItest/csv2table.py”, line 42, in expand
respone = base.add_table(file_name, lang=‘zh-cn’,columns=headers)
File “D:\Develop\Python\Python37\lib\site-packages\seatable_api\main.py”, line 236, in add_table
return parse_response(response)
File “D:\Develop\Python\Python37\lib\site-packages\seatable_api\main.py”, line 41, in parse_response
raise ConnectionError(response.status_code, response.text)
ConnectionError: [Errno 502]
是我写的有问题,还是这个API的columns参数目前有问题?