Skip to content
This repository was archived by the owner on Nov 22, 2024. It is now read-only.

Commit 756fb08

Browse files
committed
documented the "import" keywork issue for dns_records.import calls
1 parent 3dcf29e commit 756fb08

2 files changed

Lines changed: 37 additions & 3 deletions

File tree

README.md

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff 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

863863
Refer 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

889905
The following is documented within the **Advanced** option of the DNS page within the Cloudflare portal.
890906

README.rst

Lines changed: 20 additions & 2 deletions
Original file line numberDiff line numberDiff 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

876876
Refer 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+
902920
The following is documented within the **Advanced** option of the DNS page within the Cloudflare portal.
903921

904922
::

0 commit comments

Comments
 (0)