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

whois plugin #378

Merged
merged 4 commits into from
Jul 28, 2023
Merged

Conversation

jnaskali
Copy link
Contributor

This plugin can answer questions like:

  • Is the domain sweetnewdomain.com already taken?
  • When was google.com created?
  • What dns servers does duckduckgo.com use?
  • When does my domain naskali.fi expire?

domain plugin query json sometimes causes 'TypeError: Object of type datetime is not JSON serializable'
@n3d1117
Copy link
Owner

n3d1117 commented Jul 16, 2023

Hi @jnaskali awesome idea! Thanks for sharing.

Although I couldn't make it work until I changed:

try:
    whois_result = whois.whois(kwargs['domain'])
    return whois_result
except whois.parser.PywhoisError as e:
    return {'result': 'No such domain found'}
except Exception as e:
    return {'error': 'An unexpected error occurred: ' + str(e)}

to:

try:
    whois_result = whois.query(kwargs['domain'])
    if whois_result is None:
        return {'result': 'No such domain found'}
    return whois_result.__dict__
except Exception as e:
    return {'error': 'An unexpected error occurred: ' + str(e)}

Since my installation of whois had no whois function, only query. Have you seen this?

@jnaskali
Copy link
Contributor Author

Oops... I was apparently using the python-whois package for development, which uses older syntax. Your code works with the updated whois library version I manually entered in the readme, and is more elegant.

@n3d1117
Copy link
Owner

n3d1117 commented Jul 16, 2023

Cool! If you update the plugin code I'll merge this asap!

@jnaskali
Copy link
Contributor Author

Done 👍

@n3d1117 n3d1117 merged commit c277df4 into n3d1117:feature/support-functions Jul 28, 2023
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

Successfully merging this pull request may close these issues.

None yet

2 participants