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_KEY
s (which are legacy/discouraged based on above-mentioned page).
So now I wonder:
- Is it possible to use API tokens with
cloudflare-python
library? - 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")
)