最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

Using cloudflare-python with API Tokens? - Stack Overflow

programmeradmin1浏览0评论

I want to create a simple automation with my CloudFlare account, based on the docs. I created API token for my code and then I realized that I cannot find a single example of using cloudflare-python library with API Tokens. All the samples that I see use API_KEYs (which are legacy/discouraged based on above-mentioned page).

So now I wonder:

  1. Is it possible to use API tokens with cloudflare-python library?
  2. If it is, can anyone suggest the right method for creating Cloudflare client with API Token?

I tried the following, but I get error 400 - Unable to Authenticate request, so I guess it's not that simple.

client = Cloudflare(
    api_token=os.environ.get("CLOUDFLARE_API_TOKEN")
)
发布评论

评论列表(0)

  1. 暂无评论