- Implementeation of namecheap.domains.dns.getHosts API#1
Conversation
yonjuuni
left a comment
There was a problem hiding this comment.
Please look through the comments to the PR - the method should be somewhat extended before I can merge it. Also it needs a new unit test.
|
|
||
| def get_host_records(self): | ||
| pass | ||
| https://www.namecheap.com/support/api/methods/domains-dns/get-list.aspx |
There was a problem hiding this comment.
The correct URL is https://www.namecheap.com/support/api/methods/domains-dns/get-hosts/
| 'MXPrefs': record_mxprefs, | ||
| 'TTL': record_ttl, | ||
| } | ||
| """ |
There was a problem hiding this comment.
Add "Raises" section similar to get_nameservers() method, the exception may be raised by self._normalize_domain()
| list/tuple of two elements: ('domain', 'tld'). | ||
|
|
||
| Returns: | ||
| A dict with domain nameserver information |
There was a problem hiding this comment.
A dict with DNS host records information
The return structure should be extended - there are attributes on DomainDNSGetHostsResult node (Domain, IsUsingOurDNS, EmailType) that should be included in the response, so...
{
'Domain': domain,
'IsUsingOurDNS': True/False,
'EmailType': 'NONE',
'Hosts': [
{
'ID': host_id,
'Type': record_type,
'Address': record_address,
'MXPrefs': record_mxprefs,
'TTL': record_ttl,
}
]
}
... which should also be reflected in the code. This will probably break your existing API and you would have to use a hypothetical response['Hosts'] instead of response to access the same data.
| }) | ||
|
|
||
| return hosts | ||
| #hosts |
| record_name = host_record.get('Name') | ||
| record_type = host_record.get('Type') | ||
| record_address = host_record.get('Address') | ||
| record_mxprefs = host_record.get('MXPrefs') |
There was a problem hiding this comment.
record_mxpref = host_record.get('MXPref')
| 'Name': record_name, | ||
| 'Type': record_type, | ||
| 'Address': record_address, | ||
| 'MXPrefs': record_mxprefs, |
No description provided.