Bemmu / PyNamecheap

Namecheap API client in Python.
MIT License
197 stars 69 forks source link

Two new methods #16

Open gstein opened 7 years ago

gstein commented 7 years ago

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

Bemmu commented 6 years ago

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?

gstein commented 6 years ago

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 commented 6 years ago

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: