Cloudinary error: "please access via api-eu.cloudinary.com"

Cloudinary error: "please access via api-eu.cloudinary.com"

当我尝试通过 Python 将图像上传到 Cloudinary 时:

import cloudinary.uploader

cloudinary.config(
  cloud_name = 'our-name-eu',
  api_key = '…',
  api_secret = '…',
  private_cdn = True,
  secure_distribution = 'our-name-eu-res.cloudinary.com'
)
cloudinary.uploader.upload("https://i.ytimg.com/vi/2fb-g_V-UT4/hqdefault.jpg")

然后我得到以下错误:

Error: Cloud our-name-eu belongs to eu geo, please access via api-eu.cloudinary.com

虽然 I see in the docs of the API API URL 的结构类似于 https://api.cloudinary.com/v1_1/<cloud name>/<resource_type>/upload 我想我可以用 api-eu 替换 api 但我不知道看不出如何在 Python 模块中指定它。

我正在使用 Python 3.7.2 和来自 pipcloudinary 包。

正在查看 the source code:

def cloudinary_api_url(action='upload', **options):
    cloudinary_prefix = options.get("upload_prefix", cloudinary.config().upload_prefix)\
                        or "https://api.cloudinary.com"
    cloud_name = options.get("cloud_name", cloudinary.config().cloud_name)
    if not cloud_name:
        raise ValueError("Must supply cloud_name")
    resource_type = options.get("resource_type", "image")

    return encode_unicode_url("/".join([cloudinary_prefix, "v1_1", cloud_name, resource_type, action]))

好像相关的配置键是upload_prefix

作为参考,我通过在其存储库的 Python 文件中搜索默认值找到了这个:https://github.com/cloudinary/pycloudinary/search?l=Python&q=api.cloudinary.com.