This repository was archived by the owner on Nov 22, 2024. It is now read-only.
File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -858,7 +858,7 @@ $ cli4 /zones/:example.com/dnssec
858858$
859859```
860860
861- ### Zone file upload and download CLI examples (uses BIND format files)
861+ ### Zone file upload (i.e. import) CLI examples (uses BIND format files)
862862
863863Refer to [ Import DNS records] ( https://api.cloudflare.com/#dns-records-for-a-zone-import-dns-records ) on API documentation for this feature.
864864
@@ -885,6 +885,22 @@ $ cli4 --post file=@zone.txt /zones/:example.com/dns_records/import
885885}
886886$
887887```
888+
889+ ### Zone file upload (i.e. import) Python examples (uses BIND format files)
890+
891+ Because ` import ` is a reserved word in Python there needs to be a slight workaround to calling this within code.
892+
893+ ```
894+ #
895+ # "import" is a reserved word and hence this code - it's ugly; but correct.
896+ #
897+ dns_records_import = getattr(cf.zones.dns_records, 'import')
898+ r = dns_records_import.post(zone_id, files={'file':fd})
899+ ```
900+
901+ See (examples/example_dns_import.py)[ examples/example_dns_import.py] for working code.
902+
903+ ### Zone file download (i.e. export) CLI examples (uses BIND format files)
888904
889905The following is documented within the ** Advanced** option of the DNS page within the Cloudflare portal.
890906
Original file line number Diff line number Diff line change @@ -870,8 +870,8 @@ DNSSEC CLI examples
870870 }
871871 $
872872
873- Zone file upload and download CLI examples (uses BIND format files)
874- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
873+ Zone file upload (i.e. import) CLI examples (uses BIND format files)
874+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
875875
876876Refer to `Import DNS records <https://api.cloudflare.com/#dns-records-for-a-zone-import-dns-records >`__ on API documentation for this feature.
877877
@@ -899,6 +899,24 @@ Refer to `Import DNS records <https://api.cloudflare.com/#dns-records-for-a-zone
899899 }
900900 $
901901
902+ Zone file upload (i.e. import) Python examples (uses BIND format files)
903+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
904+
905+ Because ``import `` is a reserved word in Python there needs to be a slight workaround to calling this within code.
906+
907+ ::
908+
909+ #
910+ # "import" is a reserved word and hence this code - it's ugly; but correct.
911+ #
912+ dns_records_import = getattr(cf.zones.dns_records, 'import')
913+ r = dns_records_import.post(zone_id, files={'file':fd})
914+
915+ See (examples/example_dns_import.py)[examples/example_dns_import.py] for working code.
916+
917+ Zone file download (i.e. export) CLI examples (uses BIND format files)
918+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
919+
902920The following is documented within the **Advanced ** option of the DNS page within the Cloudflare portal.
903921
904922::
You can’t perform that action at this time.
0 commit comments