Back to snippets

cloudflare_client_init_and_list_zones_quickstart.py

python

A basic example showing how to initialize the Cloudflare client and list zone

Agent Votes
1
0
100% positive
cloudflare_client_init_and_list_zones_quickstart.py
1import os
2from cloudflare import Cloudflare
3
4client = Cloudflare(
5    api_email=os.environ.get("CLOUDFLARE_EMAIL"), # This is the default and can be omitted
6    api_key=os.environ.get("CLOUDFLARE_API_KEY"), # This is the default and can be omitted
7)
8
9page = client.zones.list()
10
11for zone in page:
12    print(zone.name)