将 .txt 文件上传到 contentful

问题描述

我正在尝试使用 contentful 的 python api 将 .txt 文件从计算机上传到 contentful。这是 documentation链接 下面是我的代码

with open('/Users/p2335/Documents/Work/files/input/test.txt','rb') as file:
    new_upload = client.uploads(space_id).create(file)

client.assets(space_id,'dev').create(
    'ptn2',{
        'fields': {
            'file': {
                'en-US': {
                    'fileName': 'rds1.txt','contentType': 'text/plain','uploadFrom': new_upload.to_link().to_json()
                }
            }
        }
    }
)

但是,当我满意地签入时,我没有看到该文件。下面是截图

enter image description here

在这里做错了什么?

解决方法

我相信您还需要通过调用 $ microk8s disable kubeflow File "/snap/microk8s/2213/scripts/wrappers/common/../../../actions/disable.kubeflow.sh",line 52 click.echo(f"Destroying Kubeflow {resource}...") 来启动资产处理。我无法从文档中判断是否应该调用 create 来启动此调用,但似乎没有。