From 8a53a4056626a028c30df7305eb33d68f32d4cce Mon Sep 17 00:00:00 2001 From: Aji Mufti Date: Mon, 29 Jul 2024 15:19:10 +0700 Subject: [PATCH] add examples to create dns record --- examples/dns/record.py | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100644 examples/dns/record.py diff --git a/examples/dns/record.py b/examples/dns/record.py new file mode 100644 index 00000000000..2c1c2ae9470 --- /dev/null +++ b/examples/dns/record.py @@ -0,0 +1,26 @@ +from cloudflare import Cloudflare + + +# define your variable here + +cloudflare_token = "your-cloudflare-token" +cloudflare_zone_id = "zone" +alias_name = "www.mydns.com" +cannonical_name = "cname.example.com" + +# build cloudflare driver here +client = Cloudflare(api_token=cloudflare_token) + + + +# create dns using defined driver +dns = client.dns.records.create( + zone_id=cloudflare_zone_id, + type='CNAME', + name=alias_name, + content=cannonical_name, + proxied=False + ) + +# print output +print(dns) \ No newline at end of file