Skip to content

Commit

Permalink
documented the "import" keywork issue for dns_records.import calls
Browse files Browse the repository at this point in the history
  • Loading branch information
mahtin committed Apr 1, 2022
1 parent 3dcf29e commit 756fb08
Show file tree
Hide file tree
Showing 2 changed files with 37 additions and 3 deletions.
18 changes: 17 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -858,7 +858,7 @@ $ cli4 /zones/:example.com/dnssec
$
```

### Zone file upload and download CLI examples (uses BIND format files)
### Zone file upload (i.e. import) CLI examples (uses BIND format files)

Refer to [Import DNS records](https://api.cloudflare.com/#dns-records-for-a-zone-import-dns-records) on API documentation for this feature.

Expand All @@ -885,6 +885,22 @@ $ cli4 --post file=@zone.txt /zones/:example.com/dns_records/import
}
$
```

### Zone file upload (i.e. import) Python examples (uses BIND format files)

Because `import` is a reserved word in Python there needs to be a slight workaround to calling this within code.

```
#
# "import" is a reserved word and hence this code - it's ugly; but correct.
#
dns_records_import = getattr(cf.zones.dns_records, 'import')
r = dns_records_import.post(zone_id, files={'file':fd})
```

See (examples/example_dns_import.py)[examples/example_dns_import.py] for working code.

### Zone file download (i.e. export) CLI examples (uses BIND format files)

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

Expand Down
22 changes: 20 additions & 2 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -870,8 +870,8 @@ DNSSEC CLI examples
}
$
Zone file upload and download CLI examples (uses BIND format files)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Zone file upload (i.e. import) CLI examples (uses BIND format files)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Refer to `Import DNS records <https://api.cloudflare.com/#dns-records-for-a-zone-import-dns-records>`__ on API documentation for this feature.

Expand Down Expand Up @@ -899,6 +899,24 @@ Refer to `Import DNS records <https://api.cloudflare.com/#dns-records-for-a-zone
}
$
Zone file upload (i.e. import) Python examples (uses BIND format files)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Because ``import`` is a reserved word in Python there needs to be a slight workaround to calling this within code.

::

#
# "import" is a reserved word and hence this code - it's ugly; but correct.
#
dns_records_import = getattr(cf.zones.dns_records, 'import')
r = dns_records_import.post(zone_id, files={'file':fd})

See (examples/example_dns_import.py)[examples/example_dns_import.py] for working code.

Zone file download (i.e. export) CLI examples (uses BIND format files)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

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

::
Expand Down

0 comments on commit 756fb08

Please sign in to comment.