<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Qasim</title>
    <description>The latest articles on DEV Community by Qasim (@qasimleoo).</description>
    <link>https://dev.to/qasimleoo</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F3987710%2F37ff4ed7-f027-459a-a467-ee9218a97a16.jpeg</url>
      <title>DEV Community: Qasim</title>
      <link>https://dev.to/qasimleoo</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/qasimleoo"/>
    <language>en</language>
    <item>
      <title>4 Ways to Do a WHOIS Lookup From Code (Tested on 5 Real Domains)</title>
      <dc:creator>Qasim</dc:creator>
      <pubDate>Fri, 04 Dec 2026 08:17:21 +0000</pubDate>
      <link>https://dev.to/whoisfreaks/4-ways-to-do-a-whois-lookup-from-code-tested-on-5-real-domains-3ngc</link>
      <guid>https://dev.to/whoisfreaks/4-ways-to-do-a-whois-lookup-from-code-tested-on-5-real-domains-3ngc</guid>
      <description>&lt;p&gt;Getting WHOIS data into a script sounds like a one-liner until you hit a TLD that doesn't behave. I tried the four usual routes against the same list of domains and saved what each one printed.&lt;/p&gt;

&lt;p&gt;The list is small but mean:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;github.com    lemonde.fr    socket.io    spiegel.de    bbc.co.uk
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;One boring .com and four country codes from different registries. Everything below ran on 4 December 2026 on Ubuntu, except the API call at the end.&lt;/p&gt;

&lt;h2&gt;
  
  
  1. Shelling out to &lt;code&gt;whois&lt;/code&gt;
&lt;/h2&gt;

&lt;p&gt;Preinstalled on macOS, one &lt;code&gt;apt install whois&lt;/code&gt; away on Debian and Ubuntu. It speaks the old port-43 protocol and hands you plain text.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="k"&gt;for&lt;/span&gt; d &lt;span class="k"&gt;in&lt;/span&gt; github.com lemonde.fr socket.io spiegel.de bbc.co.uk&lt;span class="o"&gt;;&lt;/span&gt; &lt;span class="k"&gt;do&lt;/span&gt;
  &lt;span class="nb"&gt;echo&lt;/span&gt; &lt;span class="s2"&gt;"== $d"&lt;/span&gt;
  whois &lt;span class="s2"&gt;"$d"&lt;/span&gt; &lt;span class="o"&gt;|&lt;/span&gt; grep -iE &lt;span class="s1"&gt;'registrar:|creation date|created:|registered on|expir'&lt;/span&gt; &lt;span class="o"&gt;|&lt;/span&gt; head -4
&lt;span class="k"&gt;done&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fmd4rv6l5s5ub4xl8d3s8.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fmd4rv6l5s5ub4xl8d3s8.png" alt="The whois loop and its output for the five domains, with four problems flagged" width="800" height="517"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The same output as text:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;== github.com
   Creation Date: 2007-10-09T18:20:50Z
   Registry Expiry Date: 2028-10-09T18:20:50Z
   Registrar: MarkMonitor Inc.
NOTICE: The expiration date displayed in this record is the date the
== lemonde.fr
registrar:                     NAMESHIELD
Expiry Date:                   2027-06-09T22:08:09Z
created:                       2005-08-02T14:16:36Z
registrar:                     NAMESHIELD
== socket.io
Creation Date: 2010-04-18T22:40:06Z
Registry Expiry Date: 2027-04-18T22:40:06Z
Registrar: MarkMonitor Inc.
== spiegel.de
== bbc.co.uk
    Registrar:
        Registered on: before Aug-1996
        Expiry date:  13-Dec-2034
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;My grep is already sloppy after five domains. It grabbed a line of legal boilerplate for github.com and the registrar twice for lemonde.fr, because .fr repeats it in every contact block. spiegel.de matched nothing: Germany's registry only sends nameservers, a status and a changed date over port 43. And bbc.co.uk has no real date, just &lt;code&gt;before Aug-1996&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;Nominet also adds a banner to every .uk reply: WHOIS for .uk shuts down on 9 February 2027. So don't build anything long-lived on scraping it.&lt;/p&gt;

&lt;p&gt;Good for: a quick look in a terminal. Painful for: anything that has to parse more than one registry.&lt;/p&gt;

&lt;h2&gt;
  
  
  2. RDAP with &lt;code&gt;curl&lt;/code&gt; and &lt;code&gt;jq&lt;/code&gt;
&lt;/h2&gt;

&lt;p&gt;RDAP is WHOIS over HTTPS with JSON responses. For gTLDs it has been the official source since January 2025. You don't need to know which server to ask, because &lt;code&gt;rdap.org&lt;/code&gt; redirects you.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="k"&gt;for&lt;/span&gt; d &lt;span class="k"&gt;in&lt;/span&gt; github.com lemonde.fr socket.io spiegel.de bbc.co.uk&lt;span class="o"&gt;;&lt;/span&gt; &lt;span class="k"&gt;do&lt;/span&gt;
  &lt;span class="nv"&gt;code&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="nv"&gt;$(&lt;/span&gt;curl -sL -o &lt;span class="s2"&gt;"rdap-$d.json"&lt;/span&gt; -w &lt;span class="s1"&gt;'%{http_code}'&lt;/span&gt; &lt;span class="s2"&gt;"https://rdap.org/domain/$d"&lt;/span&gt;&lt;span class="o"&gt;)&lt;/span&gt;
  &lt;span class="nb"&gt;echo&lt;/span&gt; &lt;span class="s2"&gt;"== $d HTTP $code"&lt;/span&gt;
  &lt;span class="o"&gt;[&lt;/span&gt; &lt;span class="s2"&gt;"$code"&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; 200 &lt;span class="o"&gt;]&lt;/span&gt; &lt;span class="o"&gt;&amp;amp;&amp;amp;&lt;/span&gt; jq -c &lt;span class="s1"&gt;'{
    registrar: ([.entities[]? | select(.roles | index("registrar"))
                 | .vcardArray[1][]? | select(.[0] == "fn") | .[3]] | first),
    events: ([.events[]? | {(.eventAction): .eventDate}] | add)
  }'&lt;/span&gt; &lt;span class="s2"&gt;"rdap-$d.json"&lt;/span&gt;
&lt;span class="k"&gt;done&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;





&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight http"&gt;&lt;code&gt;&lt;span class="o"&gt;==&lt;/span&gt; &lt;span class="n"&gt;github&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;com&lt;/span&gt; &lt;span class="no"&gt;HTTP&lt;/span&gt; &lt;span class="mi"&gt;200&lt;/span&gt;
&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="s2"&gt;"registrar"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="s2"&gt;"MarkMonitor Inc."&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="s2"&gt;"events"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="s2"&gt;"registration"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="s2"&gt;"2007-10-09T18:20:50Z"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="s2"&gt;"expiration"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="s2"&gt;"2028-10-09T18:20:50Z"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="s2"&gt;"last changed"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="s2"&gt;"2026-09-07T09:22:52Z"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="s2"&gt;"last update of RDAP database"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="s2"&gt;"2026-12-04T04:49:43Z"&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="o"&gt;==&lt;/span&gt; &lt;span class="n"&gt;lemonde&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;fr&lt;/span&gt; &lt;span class="no"&gt;HTTP&lt;/span&gt; &lt;span class="mi"&gt;200&lt;/span&gt;
&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="s2"&gt;"registrar"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="s2"&gt;"NAMESHIELD"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="s2"&gt;"events"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="s2"&gt;"registration"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="s2"&gt;"2005-08-02T14:16:36Z"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="s2"&gt;"expiration"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="s2"&gt;"2027-06-09T22:08:09Z"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="s2"&gt;"last changed"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="s2"&gt;"2026-06-12T22:48:47.579297Z"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="s2"&gt;"transfer"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="s2"&gt;"2022-06-09T22:08:09Z"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="s2"&gt;"last update of RDAP database"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="s2"&gt;"2026-12-04T04:49:51.222453284Z"&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="o"&gt;==&lt;/span&gt; &lt;span class="n"&gt;socket&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;io&lt;/span&gt; &lt;span class="no"&gt;HTTP&lt;/span&gt; &lt;span class="mi"&gt;404&lt;/span&gt;
&lt;span class="o"&gt;==&lt;/span&gt; &lt;span class="n"&gt;spiegel&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;de&lt;/span&gt; &lt;span class="no"&gt;HTTP&lt;/span&gt; &lt;span class="mi"&gt;404&lt;/span&gt;
&lt;span class="o"&gt;==&lt;/span&gt; &lt;span class="n"&gt;bbc&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;co&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;uk&lt;/span&gt; &lt;span class="no"&gt;HTTP&lt;/span&gt; &lt;span class="mi"&gt;200&lt;/span&gt;
&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="s2"&gt;"registrar"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="s2"&gt;"British Broadcasting Corporation"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="s2"&gt;"events"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="s2"&gt;"registration"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="s2"&gt;"1994-12-13T03:49:48Z"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="s2"&gt;"last changed"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="s2"&gt;"2025-10-29T03:51:11.009091Z"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="s2"&gt;"expiration"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="s2"&gt;"2034-12-13T03:49:48Z"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="s2"&gt;"last update of RDAP database"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="s2"&gt;"2026-12-04T04:49:53.471Z"&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Ffnsujhahcu9p85rkndn8.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Ffnsujhahcu9p85rkndn8.png" alt="RDAP events for bbc.co.uk and 404 responses for socket.io and spiegel.de" width="800" height="375"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;One jq filter works for three different registries, which felt great after method 1. bbc.co.uk even gets its real registration date, 1994-12-13, instead of "before Aug-1996".&lt;/p&gt;

&lt;p&gt;Then the two 404s. rdap.org had nothing for &lt;code&gt;.io&lt;/code&gt; or &lt;code&gt;.de&lt;/code&gt;, so 2 of my 5 domains just don't exist as far as this method is concerned.&lt;/p&gt;

&lt;p&gt;Good for: clean, official data on gTLDs and the ccTLDs that support it. You'll still want a fallback.&lt;/p&gt;

&lt;h2&gt;
  
  
  3. The &lt;code&gt;python-whois&lt;/code&gt; package
&lt;/h2&gt;

&lt;p&gt;If you live in Python, &lt;code&gt;python-whois&lt;/code&gt; wraps the WHOIS query and turns the text into attributes.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;python3 -m venv .venv &lt;span class="o"&gt;&amp;amp;&amp;amp;&lt;/span&gt; . .venv/bin/activate
pip install python-whois
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;





&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="n"&gt;whois&lt;/span&gt;

&lt;span class="no"&gt;DOMAINS&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="s2"&gt;"github.com"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s2"&gt;"lemonde.fr"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s2"&gt;"socket.io"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s2"&gt;"spiegel.de"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s2"&gt;"bbc.co.uk"&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;

&lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;first&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;value&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
    &lt;span class="c1"&gt;# Some registries return lists for dates; take the first value.&lt;/span&gt;
    &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="n"&gt;value&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="nb"&gt;isinstance&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;value&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="kt"&gt;list&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="k"&gt;else&lt;/span&gt; &lt;span class="n"&gt;value&lt;/span&gt;

&lt;span class="k"&gt;for&lt;/span&gt; &lt;span class="n"&gt;domain&lt;/span&gt; &lt;span class="k"&gt;in&lt;/span&gt; &lt;span class="no"&gt;DOMAINS&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
    &lt;span class="k"&gt;try&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
        &lt;span class="n"&gt;w&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;whois&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;whois&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;domain&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
        &lt;span class="k"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;f&lt;/span&gt;&lt;span class="s2"&gt;"{domain:12} registrar={w.registrar!s:20} "&lt;/span&gt;
              &lt;span class="n"&gt;f&lt;/span&gt;&lt;span class="s2"&gt;"created={first(w.creation_date)!s:26} expires={first(w.expiration_date)}"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="k"&gt;except&lt;/span&gt; &lt;span class="nc"&gt;Exception&lt;/span&gt; &lt;span class="k"&gt;as&lt;/span&gt; &lt;span class="n"&gt;exc&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
        &lt;span class="k"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;f&lt;/span&gt;&lt;span class="s2"&gt;"{domain:12} error: {type(exc).__name__}: {exc}"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;With python-whois 0.9.6:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;github.com   registrar=MarkMonitor Inc.     created=2007-10-09 18:20:50+00:00  expires=2028-10-09 18:20:50+00:00
lemonde.fr   registrar=NAMESHIELD           created=2005-08-02 14:16:36+00:00  expires=2027-06-09 22:08:09+00:00
socket.io    registrar=MarkMonitor Inc.     created=2010-04-18 22:40:06+00:00  expires=2027-04-18 22:40:06+00:00
spiegel.de   registrar=None                 created=None                       expires=None
bbc.co.uk    error: WhoisError: Whois command returned no output
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Real &lt;code&gt;datetime&lt;/code&gt; objects for three domains, which is nice. spiegel.de gives you a row of &lt;code&gt;None&lt;/code&gt;s, since there was nothing to parse. bbc.co.uk threw &lt;code&gt;WhoisError&lt;/code&gt; on all three of my runs, even though the plain &lt;code&gt;whois&lt;/code&gt; command answered fine. Wrap it in &lt;code&gt;try&lt;/code&gt; or one odd TLD will kill your batch job.&lt;/p&gt;

&lt;p&gt;Good for: small Python scripts where &lt;code&gt;None&lt;/code&gt; is an acceptable answer.&lt;/p&gt;

&lt;h2&gt;
  
  
  4. A WHOIS API
&lt;/h2&gt;

&lt;p&gt;The last option hands the registry mess to someone else. You send a domain, you get back the same JSON shape whatever the TLD. Full disclosure, I work at WhoisFreaks, so that's the API I used. Other WHOIS APIs follow a similar request pattern. A free key comes with 500 credits and no card, and this &lt;a href="https://whoisfreaks.com/resources/tutorial/how-to-use-the-whoisfreaks-api-for-domain-lookups?utm_source=devto&amp;amp;utm_medium=referral&amp;amp;utm_campaign=content-w49" rel="noopener noreferrer"&gt;walkthrough of the WhoisFreaks API&lt;/a&gt; shows where to get one.&lt;/p&gt;

&lt;p&gt;Put the key in an environment variable, not in the file:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="kd"&gt;export&lt;/span&gt; &lt;span class="nv"&gt;WHOISFREAKS_API_KEY&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;"your-key-here"&lt;/span&gt;
pip install requests
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;





&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="n"&gt;os&lt;/span&gt;
&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="n"&gt;time&lt;/span&gt;

&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="n"&gt;requests&lt;/span&gt;

&lt;span class="no"&gt;API_KEY&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;os&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;environ&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="s2"&gt;"WHOISFREAKS_API_KEY"&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;
&lt;span class="no"&gt;DOMAINS&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="s2"&gt;"github.com"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s2"&gt;"lemonde.fr"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s2"&gt;"socket.io"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s2"&gt;"spiegel.de"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s2"&gt;"bbc.co.uk"&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;

&lt;span class="k"&gt;for&lt;/span&gt; &lt;span class="n"&gt;domain&lt;/span&gt; &lt;span class="k"&gt;in&lt;/span&gt; &lt;span class="no"&gt;DOMAINS&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
    &lt;span class="n"&gt;r&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;requests&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;get&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
        &lt;span class="s2"&gt;"https://api.whoisfreaks.com/v1.0/whois"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
        &lt;span class="n"&gt;params&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="s2"&gt;"apiKey"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="no"&gt;API_KEY&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s2"&gt;"whois"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"live"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s2"&gt;"domainName"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;domain&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
        &lt;span class="n"&gt;timeout&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="mi"&gt;30&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="n"&gt;r&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;ok&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
        &lt;span class="n"&gt;data&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;r&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;json&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
        &lt;span class="n"&gt;registrar&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;data&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;get&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"domain_registrar"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="ow"&gt;or&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;get&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"registrar_name"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
        &lt;span class="k"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;f&lt;/span&gt;&lt;span class="s2"&gt;"{domain:12} registrar={registrar!s:30} "&lt;/span&gt;
              &lt;span class="n"&gt;f&lt;/span&gt;&lt;span class="s2"&gt;"created={data.get('create_date')}  expires={data.get('expiry_date')}"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="k"&gt;else&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
        &lt;span class="k"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;f&lt;/span&gt;&lt;span class="s2"&gt;"{domain:12} HTTP {r.status_code}"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="n"&gt;time&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;sleep&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;6&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;  &lt;span class="c1"&gt;# the free tier allows 10 live lookups a minute&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;





&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;github.com   registrar=Markmonitor Inc                created=2007-10-09  expires=2028-10-09
lemonde.fr   registrar=NAMESHIELD                     created=2005-08-02  expires=2027-06-09
socket.io    registrar=MarkMonitor Inc                created=2010-04-18  expires=2027-04-18
spiegel.de   registrar=Key-Systems GmbH               created=1994-10-26  expires=None
bbc.co.uk    registrar=British Broadcasting Corporation created=1994-12-13  expires=2034-12-13
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;When I pushed the same five domains through this API with a free key on 26 November, every one came back with a registrar and dates. That includes spiegel.de: Key-Systems GmbH, created 1994-10-26, which methods 1 to 3 couldn't get. It had no expiry date, which is right, because DENIC doesn't publish one.&lt;/p&gt;

&lt;p&gt;It isn't perfect. You spend credits once the free ones run out, the free tier is rate limited, and in our own testing a couple of domains (producthunt.com, rakuten.co.jp) came back without a registrar. We've logged those.&lt;/p&gt;

&lt;p&gt;Good for: batch jobs across many TLDs, or when you need the fields the registries don't publish.&lt;/p&gt;

&lt;h2&gt;
  
  
  Scoreboard
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fe4vssg4cemmx1808o34n.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fe4vssg4cemmx1808o34n.png" alt="Scoreboard table with each domain's result per method: whois CLI 4 of 5, RDAP 3 of 5, python-whois 3 of 5, WHOIS API 5 of 5" width="800" height="375"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;&lt;/th&gt;
&lt;th&gt;&lt;code&gt;whois&lt;/code&gt;&lt;/th&gt;
&lt;th&gt;RDAP + curl&lt;/th&gt;
&lt;th&gt;python-whois&lt;/th&gt;
&lt;th&gt;API&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Cost&lt;/td&gt;
&lt;td&gt;Free&lt;/td&gt;
&lt;td&gt;Free&lt;/td&gt;
&lt;td&gt;Free&lt;/td&gt;
&lt;td&gt;Free tier, then paid&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Output&lt;/td&gt;
&lt;td&gt;Text&lt;/td&gt;
&lt;td&gt;JSON&lt;/td&gt;
&lt;td&gt;Python objects&lt;/td&gt;
&lt;td&gt;JSON&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;One format for every TLD&lt;/td&gt;
&lt;td&gt;No&lt;/td&gt;
&lt;td&gt;Where RDAP exists&lt;/td&gt;
&lt;td&gt;Mostly&lt;/td&gt;
&lt;td&gt;Yes&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Domains with registrar or dates&lt;/td&gt;
&lt;td&gt;4/5&lt;/td&gt;
&lt;td&gt;3/5&lt;/td&gt;
&lt;td&gt;3/5&lt;/td&gt;
&lt;td&gt;5/5&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Exact bbc.co.uk created date&lt;/td&gt;
&lt;td&gt;No&lt;/td&gt;
&lt;td&gt;Yes&lt;/td&gt;
&lt;td&gt;No (error)&lt;/td&gt;
&lt;td&gt;Check your run&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;If I were wiring this up from scratch: RDAP first, since it's free and official, &lt;code&gt;whois&lt;/code&gt; as the fallback for ccTLDs RDAP can't see, and an API for batch jobs where a missing registrar is a real problem. For a single domain with no code at all, the &lt;a href="https://whoisfreaks.com/tools/whois/lookup?utm_source=devto&amp;amp;utm_medium=referral&amp;amp;utm_campaign=content-w49" rel="noopener noreferrer"&gt;WhoisFreaks lookup page&lt;/a&gt; does the same query in a browser.&lt;/p&gt;

&lt;p&gt;Got a TLD that breaks your WHOIS code? Drop it in the comments and I'll add it to the list.&lt;/p&gt;

</description>
      <category>python</category>
      <category>dns</category>
      <category>security</category>
      <category>webdev</category>
    </item>
    <item>
      <title>Really interesting approach to threat intelligence. The idea of pivoting from a single registrant identifier to uncovering an entire domain footprint is a great way to spot connections that manual investigations often miss.</title>
      <dc:creator>Qasim</dc:creator>
      <pubDate>Wed, 24 Jun 2026 15:26:30 +0000</pubDate>
      <link>https://dev.to/qasimleoo/really-interesting-approach-to-threat-intelligence-the-idea-of-pivoting-from-a-single-registrant-l2l</link>
      <guid>https://dev.to/qasimleoo/really-interesting-approach-to-threat-intelligence-the-idea-of-pivoting-from-a-single-registrant-l2l</guid>
      <description>&lt;div class="ltag__link--embedded"&gt;
  &lt;div class="crayons-story "&gt;
  &lt;a href="https://dev.to/whoisfreaks/registrant-pivot-find-every-domain-owned-by-an-email-address-using-python-hk" class="crayons-story__hidden-navigation-link"&gt;Registrant Pivot: Find Every Domain Owned by an Email Address Using Python&lt;/a&gt;


  &lt;div class="crayons-story__body crayons-story__body-full_post"&gt;
    &lt;div class="crayons-story__top"&gt;
      &lt;div class="crayons-story__meta"&gt;
        &lt;div class="crayons-story__author-pic"&gt;
          &lt;a class="crayons-logo crayons-logo--l" href="/whoisfreaks"&gt;
            &lt;img alt="WhoisFreaks logo" src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Forganization%2Fprofile_image%2F13715%2F493dcbec-3dd4-4ad0-9641-28dd0fed3109.png" class="crayons-logo__image" width="800" height="800"&gt;
          &lt;/a&gt;

          &lt;a href="/sheikhsameer009" class="crayons-avatar  crayons-avatar--s absolute -right-2 -bottom-2 border-solid border-2 border-base-inverted  "&gt;
            &lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F3974322%2F9d4f50d7-377e-48fd-915a-b5b1671f93da.png" alt="sheikhsameer009 profile" class="crayons-avatar__image" width="96" height="96"&gt;
          &lt;/a&gt;
        &lt;/div&gt;
        &lt;div&gt;
          &lt;div&gt;
            &lt;a href="/sheikhsameer009" class="crayons-story__secondary fw-medium m:hidden"&gt;
              Sameer Sheikh
            &lt;/a&gt;
            &lt;div class="profile-preview-card relative mb-4 s:mb-0 fw-medium hidden m:inline-block"&gt;
              
                Sameer Sheikh
                
              
              &lt;div id="story-author-preview-content-3980092" class="profile-preview-card__content crayons-dropdown branded-7 p-4 pt-0"&gt;
                &lt;div class="gap-4 grid"&gt;
                  &lt;div class="-mt-4"&gt;
                    &lt;a href="/sheikhsameer009" class="flex"&gt;
                      &lt;span class="crayons-avatar crayons-avatar--xl mr-2 shrink-0"&gt;
                        &lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F3974322%2F9d4f50d7-377e-48fd-915a-b5b1671f93da.png" class="crayons-avatar__image" alt="" width="96" height="96"&gt;
                      &lt;/span&gt;
                      &lt;span class="crayons-link crayons-subtitle-2 mt-5"&gt;Sameer Sheikh&lt;/span&gt;
                    &lt;/a&gt;
                  &lt;/div&gt;
                  &lt;div class="print-hidden"&gt;
                    
                      Follow
                    
                  &lt;/div&gt;
                  &lt;div class="author-preview-metadata-container"&gt;&lt;/div&gt;
                &lt;/div&gt;
              &lt;/div&gt;
            &lt;/div&gt;

            &lt;span&gt;
              &lt;span class="crayons-story__tertiary fw-normal"&gt; for &lt;/span&gt;&lt;a href="/whoisfreaks" class="crayons-story__secondary fw-medium"&gt;WhoisFreaks&lt;/a&gt;
            &lt;/span&gt;
          &lt;/div&gt;
          &lt;a href="https://dev.to/whoisfreaks/registrant-pivot-find-every-domain-owned-by-an-email-address-using-python-hk" class="crayons-story__tertiary fs-xs"&gt;&lt;time&gt;Jun 24&lt;/time&gt;&lt;span class="time-ago-indicator-initial-placeholder"&gt;&lt;/span&gt;&lt;/a&gt;
        &lt;/div&gt;
      &lt;/div&gt;

    &lt;/div&gt;

    &lt;div class="crayons-story__indention"&gt;
      &lt;h2 class="crayons-story__title crayons-story__title-full_post"&gt;
        &lt;a href="https://dev.to/whoisfreaks/registrant-pivot-find-every-domain-owned-by-an-email-address-using-python-hk" id="article-link-3980092"&gt;
          Registrant Pivot: Find Every Domain Owned by an Email Address Using Python
        &lt;/a&gt;
      &lt;/h2&gt;
        &lt;div class="crayons-story__tags"&gt;
            &lt;a class="crayons-tag  crayons-tag--monochrome " href="/t/python"&gt;&lt;span class="crayons-tag__prefix"&gt;#&lt;/span&gt;python&lt;/a&gt;
            &lt;a class="crayons-tag  crayons-tag--monochrome " href="/t/security"&gt;&lt;span class="crayons-tag__prefix"&gt;#&lt;/span&gt;security&lt;/a&gt;
            &lt;a class="crayons-tag  crayons-tag--monochrome " href="/t/cybersecurity"&gt;&lt;span class="crayons-tag__prefix"&gt;#&lt;/span&gt;cybersecurity&lt;/a&gt;
            &lt;a class="crayons-tag  crayons-tag--monochrome " href="/t/tutorial"&gt;&lt;span class="crayons-tag__prefix"&gt;#&lt;/span&gt;tutorial&lt;/a&gt;
        &lt;/div&gt;
      &lt;div class="crayons-story__bottom"&gt;
        &lt;div class="crayons-story__details"&gt;
          &lt;a href="https://dev.to/whoisfreaks/registrant-pivot-find-every-domain-owned-by-an-email-address-using-python-hk" class="crayons-btn crayons-btn--s crayons-btn--ghost crayons-btn--icon-left"&gt;
            &lt;div class="multiple_reactions_aggregate"&gt;
              &lt;span class="multiple_reactions_icons_container"&gt;
                  &lt;span class="crayons_icon_container"&gt;
                    &lt;img src="https://assets.dev.to/assets/exploding-head-daceb38d627e6ae9b730f36a1e390fca556a4289d5a41abb2c35068ad3e2c4b5.svg" width="24" height="24"&gt;
                  &lt;/span&gt;
                  &lt;span class="crayons_icon_container"&gt;
                    &lt;img src="https://assets.dev.to/assets/multi-unicorn-b44d6f8c23cdd00964192bedc38af3e82463978aa611b4365bd33a0f1f4f3e97.svg" width="24" height="24"&gt;
                  &lt;/span&gt;
                  &lt;span class="crayons_icon_container"&gt;
                    &lt;img src="https://assets.dev.to/assets/sparkle-heart-5f9bee3767e18deb1bb725290cb151c25234768a0e9a2bd39370c382d02920cf.svg" width="24" height="24"&gt;
                  &lt;/span&gt;
              &lt;/span&gt;
              &lt;span class="aggregate_reactions_counter"&gt;5&lt;span class="hidden s:inline"&gt;&amp;nbsp;reactions&lt;/span&gt;&lt;/span&gt;
            &lt;/div&gt;
          &lt;/a&gt;
            &lt;a href="https://dev.to/whoisfreaks/registrant-pivot-find-every-domain-owned-by-an-email-address-using-python-hk#comments" class="crayons-btn crayons-btn--s crayons-btn--ghost crayons-btn--icon-left flex items-center"&gt;
              

              1&lt;span class="hidden s:inline"&gt;&amp;nbsp;comment&lt;/span&gt;
            &lt;/a&gt;
        &lt;/div&gt;
        &lt;div class="crayons-story__save"&gt;
          &lt;small class="crayons-story__tertiary fs-xs mr-2"&gt;
            7 min read
          &lt;/small&gt;
            
              &lt;span class="bm-initial crayons-icon c-btn__icon"&gt;
                

              &lt;/span&gt;
              &lt;span class="bm-success crayons-icon c-btn__icon"&gt;
                

              &lt;/span&gt;
            
        &lt;/div&gt;
      &lt;/div&gt;
    &lt;/div&gt;
  &lt;/div&gt;
&lt;/div&gt;

&lt;/div&gt;


</description>
    </item>
  </channel>
</rss>
