Skip to content

Commit 8a53a40

Browse files
committed
add examples to create dns record
1 parent d04dfee commit 8a53a40

File tree

1 file changed

+26
-0
lines changed

1 file changed

+26
-0
lines changed

examples/dns/record.py

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
from cloudflare import Cloudflare
2+
3+
4+
# define your variable here
5+
6+
cloudflare_token = "your-cloudflare-token"
7+
cloudflare_zone_id = "zone"
8+
alias_name = "www.mydns.com"
9+
cannonical_name = "cname.example.com"
10+
11+
# build cloudflare driver here
12+
client = Cloudflare(api_token=cloudflare_token)
13+
14+
15+
16+
# create dns using defined driver
17+
dns = client.dns.records.create(
18+
zone_id=cloudflare_zone_id,
19+
type='CNAME',
20+
name=alias_name,
21+
content=cannonical_name,
22+
proxied=False
23+
)
24+
25+
# print output
26+
print(dns)

0 commit comments

Comments
 (0)