我将 Python 客户端用于Contentful Content Management API ,目前无法处理或发布资产。在每种情况下,API 都会返回:
contentful_management.errors. NotFoundError: HTTP status code: 404 Message: The resource could not be found. Details: The requested Asset could not be found.
创建资产后,我可以访问其 id,因此假设那时我应该能够处理和发布。我的代码如下。有谁知道我可能做错了什么?
"""
Creating an asset requires three steps and API calls:
1. Create an asset.
2. Process an asset.
3. Publish an asset.
"""
def create_asset(self, path):
p = os.path.abspath(path)
return self.authorised_user.uploads(self.test_space_id).create(p)
def process_asset(self, asset_id):
asset = self.authorised_user.assets(self.test_space_id, self.test_environment_id).find(asset_id)
asset.process()
def publish_asset(self, asset_id):
asset = self.authorised_user.assets(self.test_space_id, self.test_environment_id).find(asset_id)
asset.publish()