Skip to content

Commit

Permalink
add examples to create dns record
Browse files Browse the repository at this point in the history
  • Loading branch information
mftzk committed Jul 29, 2024
1 parent d04dfee commit 8a53a40
Showing 1 changed file with 26 additions and 0 deletions.
26 changes: 26 additions & 0 deletions examples/dns/record.py
Original file line number Diff line number Diff line change
@@ -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)

0 comments on commit 8a53a40

Please sign in to comment.