dnsrobocert icon indicating copy to clipboard operation
dnsrobocert copied to clipboard

debug request and response

Open simonmcnair opened this issue 2 years ago • 3 comments

Hi, I've been troubleshooting a namecheap issue for the past two days, and it would help immensely to have a debug option which includes the api requests and responses.

This is an enhancement.

So far I have narrowed the issue to too many values to unpack as my domain is a .co.uk (namecheap.py line 403) I tried delegated domain but it didn't work either.

Troubleshooting continues :-)

simonmcnair avatar May 06 '22 09:05 simonmcnair

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

simonmcnair avatar May 06 '22 13:05 simonmcnair

I would still like a debug flag though :-)

I added

      print("--- Request ---")
        print(response.url)
        print(extra_payload)
        print("--- Response ---")
        print(response.text)

prior to

  if not 200 <= response.status_code <= 299:
        raise _ApiError("1", "Did not receive 200 (Ok) response")

simonmcnair avatar May 06 '22 13:05 simonmcnair