PyNamecheap icon indicating copy to clipboard operation
PyNamecheap copied to clipboard

Two new methods

Open gstein opened this issue 7 years ago • 3 comments

I extended your Api object within my app (not fork), so I don't have a proper Pull Request for these changes. However, I figured it would be helpful to share the extension for your consideration.

There is some code in here that is specific to my application, but you may be able to extract something generally useful.

extended.txt

gstein avatar Aug 09 '17 13:08 gstein

Thank you.

I see there is a check for Whoisguard. That one I understand.

What is this ProviderType FREE or CUSTOM stuff? How about Premium?

Anything else here I missed?

Bemmu avatar Dec 19 '17 13:12 Bemmu

In my application, we have domains that are configured for BasicDNS, or a custom set of nameservers. If a domain ended up with PremiumDNS, then this snippet would return None (interpreted as mis-configuration).

Note that the status never returns "Locked", contrary to the API documentation. I contacted Namecheap support, and they replied that the RegistrarLockStatus is the way to query that (thus, the separate method).

In this snippet, I extracted the domain expiration date as a string. It might be nice to parse that into a datetime object. (right now, my app ignores it; we only have about 50 domains, so this isn't a concern for automation)

gstein avatar Dec 19 '17 14:12 gstein

I forgot to include BASIC_DNS in that snippet:

# a unique object to signal the domain is using "Namecheap BasicDNS"
BASIC_DNS = object()

The caller can then do something like if nameservers is BASIC_DNS:

gstein avatar Dec 19 '17 14:12 gstein