Skip to content

Commit

Permalink
Allow getting zone records of specific type (#5)
Browse files Browse the repository at this point in the history
  • Loading branch information
ctalkington committed Oct 6, 2020
1 parent db2c3c4 commit 522a103
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion pycfdns/__init__.py
Expand Up @@ -46,11 +46,14 @@ async def get_zone_id(self):
raise CloudflareZoneException("Could not get zone ID") from error
return zone_id

async def get_zone_records(self, zone_id):
async def get_zone_records(self, zone_id, record_type = None):
"""Get the records of a zone."""
records = []

endpoint = f"{zone_id}/dns_records&per_page=100"
if record_type:
endpoint += f"&type={record_type}"

url = BASE_URL.format(endpoint)
data = await self.api.get_json(url)
data = data["result"]
Expand Down

0 comments on commit 522a103

Please sign in to comment.