Forked from alfredocambera/cloudflare-list-zones-and-records.py
Created
August 28, 2023 19:10
-
-
Save ssstonebraker/6b00a6bb182ffd2c76774cae05ef768d to your computer and use it in GitHub Desktop.
Lists cloudflare zones an DNS records
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/usr/bin/env python | |
| import CloudFlare | |
| cf = CloudFlare.CloudFlare(token='REPLACE_WITH_YOUR_OWN_TOKEN') | |
| zones = cf.zones.get() | |
| for zone in zones: | |
| zone_id = zone['id'] | |
| zone_name = zone['name'] | |
| print(f"zone_id: {zone_id}, zone_name: {zone_name}") | |
| for record in cf.zones.dns_records.get(zone['id'], params={'per_page':100}): | |
| print(f"name: {record['name']}, type: {record['type']}, value: {record['content']}, id: {record['id']}") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment