Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add examples to create dns record #1231

Merged
merged 11 commits into from
Jul 31, 2024
20 changes: 20 additions & 0 deletions examples/dns/record.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
import os
import sys

from cloudflare import Cloudflare

zone_id = os.getenv("CLOUDFLARE_ZONE_ID")
if zone_id is None:
sys.exit("CLOUDFLARE_ZONE_ID is not defined")

client = Cloudflare()

record = client.dns.records.create(
zone_id=zone_id,
type='CNAME',
name="www.mydns.com",
content="cname.example.com",
proxied=False
)

# print(record)
Loading