Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Failure when using two part TLDs (namecheap) #353

Closed
snk-nick opened this issue Jan 31, 2019 · 5 comments
Closed

Failure when using two part TLDs (namecheap) #353

snk-nick opened this issue Jan 31, 2019 · 5 comments

Comments

@snk-nick
Copy link

Authentication fails to namecheap when trying to use any .net.au or .com.au TLD. Using .com or .net domains under same account with same code work no issues.

Hook command "/etc/letsencrypt/scripts/lexicon-namecheap.sh create" returned error code 255 Error output from lexicon-namecheap.sh: Traceback (most recent call last): File "/usr/local/bin/lexicon", line 10, in <module> sys.exit(main()) File "/usr/local/lib/python3.5/dist-packages/lexicon/cli.py", line 117, in main results = client.execute() File "/usr/local/lib/python3.5/dist-packages/lexicon/client.py", line 71, in execute return self.provider.create_record(record_type, name, content) File "/usr/local/lib/python3.5/dist-packages/lexicon/providers/base.py", line 80, in create_record return self._create_record(rtype, name, content) File "/usr/local/lib/python3.5/dist-packages/lexicon/providers/namecheap.py", line 201, in _create_record self.client.domains_dns_addHost(self.domain, record) File "/usr/local/lib/python3.5/dist-packages/namecheap.py", line 373, in domains_dns_addHost host_records_remote = self.domains_dns_getHosts(domain) File "/usr/local/lib/python3.5/dist-packages/namecheap.py", line 346, in domains_dns_getHosts sld, tld = domain.split(".") ValueError: too many values to unpack (expected 2)

@adferrand
Copy link
Collaborator

adferrand commented Jan 31, 2019

This is typically why we use in Lexicon tldextract to smartly extract out the TLD part from a domain, that is indeed .net.au, and not .au as naive .split('.'.) gives here.

Sadly this issue arises from upstream project PyNamecheap that is used by Lexicon in the namecheap provider. So we cannot directly correct the issue because the latest published version of PyNamecheap contains the faulty logic.

I would advise you to open the issue on upstream project, https://github.com/Bemmu/PyNamecheap, to ask a fix and a new version. Then I will be glad to upgrade Lexicon dependency and fix the issue on our side.

@snk-nick
Copy link
Author

Thanks, I've opened that here: Bemmu/PyNamecheap#25

@AnalogJ
Copy link
Owner

AnalogJ commented Feb 25, 2019

Closing this, as its related to an issue in an upstream library.

@AnalogJ AnalogJ closed this as completed Feb 25, 2019
@simonmcnair
Copy link
Contributor

This should be re-opened now that pynamecheap isn't use dany more and the issue still exists ?

@simonmcnair
Copy link
Contributor

I have got this working, I think by modifying /usr/local/lib/python3.9/site-packages/lexicon/providers/namecheap.py ( https://github.com/AnalogJ/lexicon/blob/master/lexicon/providers/namecheap.py)

I added:

import tldextract

and then replacing all the occurrences of:

    sld, tld = domain.split(".")

with:

    extracted = tldextract.extract(domain)
    sld = extracted.domain
    tld = extracted.suffix

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants