obynio / certbot-plugin-gandi

Certbot plugin for authentication using Gandi LiveDNS

Home Page:https://pypi.org/project/certbot-plugin-gandi/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

AttributeError: 'module' object has no attribute 'parse'

woffleloffle opened this issue · comments

Trying to run the following on Ubuntu 18:

certbot certonly -a certbot-plugin-gandi:dns --certbot-plugin-gandi:dns-credentials /path/to/gandi.ini -d \*.sub.domain.com --server https://acme-v02.api.letsencrypt.org/directory

Throws the following error:

Encountered exception during recovery:
Traceback (most recent call last):
  File "/usr/local/lib/python2.7/dist-packages/certbot/error_handler.py", line 108, in _call_registered
    self.funcs[-1]()
  File "/usr/local/lib/python2.7/dist-packages/certbot/auth_handler.py", line 310, in _cleanup_challenges
    self.auth.cleanup(achalls)
  File "/usr/local/lib/python2.7/dist-packages/certbot/plugins/dns_common.py", line 76, in cleanup
    self._cleanup(domain, validation_domain_name, validation)
  File "/usr/local/lib/python2.7/dist-packages/certbot_plugin_gandi/main.py", line 54, in _cleanup
    error = gandi_api.del_txt_record(self._get_gandi_config(), domain, validation_name)
  File "/usr/local/lib/python2.7/dist-packages/certbot_plugin_gandi/gandi_api.py", line 97, in del_txt_record
    return _update_record(cfg, domain, name, requester)
  File "/usr/local/lib/python2.7/dist-packages/certbot_plugin_gandi/gandi_api.py", line 69, in _update_record
    base_domain = _get_base_domain(cfg, domain)
  File "/usr/local/lib/python2.7/dist-packages/certbot_plugin_gandi/gandi_api.py", line 48, in _get_base_domain
    response = _request(cfg, 'GET', ('domains', candidate_base_domain))
  File "/usr/local/lib/python2.7/dist-packages/certbot_plugin_gandi/gandi_api.py", line 42, in _request
    url = _get_url(*segs)
  File "/usr/local/lib/python2.7/dist-packages/certbot_plugin_gandi/gandi_api.py", line 36, in _get_url
    '/'.join(urllib.parse.quote(seg, safe='') for seg in segs)
  File "/usr/local/lib/python2.7/dist-packages/certbot_plugin_gandi/gandi_api.py", line 36, in <genexpr>
    '/'.join(urllib.parse.quote(seg, safe='') for seg in segs)
AttributeError: 'module' object has no attribute 'parse'
An unexpected error occurred:
AttributeError: 'module' object has no attribute 'parse'

Any pointers would be appreciated.

Thanks for noticing !

This is due to python2 using urllib2 and python3 using urllib3. The code was made with python3 in mind but I've just added some conditions to make the module backward compatible with python2.

This issue should now be solved 👍

@WillemLabu any feedback ?

Sorry for the delay!
I haven't been able to check. I installed a cert manually.
It's on my to do list, and I'll get back to you soon.