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

debug request and response #763

Open
simonmcnair opened this issue May 6, 2022 · 2 comments
Open

debug request and response #763

simonmcnair opened this issue May 6, 2022 · 2 comments

Comments

@simonmcnair
Copy link

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
Copy link
Author

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
Copy link
Author

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")

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

1 participant