python-whois


Namepython-whois JSON
Version 0.9.4 PyPI version JSON
download
home_pagehttps://github.com/richardpenman/whois
SummaryWhois querying and parsing of domain registration information.
upload_time2024-04-26 09:22:25
maintainerNone
docs_urlNone
authorRichard Penman
requires_pythonNone
licenseMIT
keywords whois python
VCS
bugtrack_url
requirements python-dateutil
Travis-CI No Travis.
coveralls test coverage No coveralls.
            Goal
====

-  Create a simple importable Python module which will produce parsed
   WHOIS data for a given domain.
-  Able to extract data for all the popular TLDs (com, org, net, ...)
-  Query a WHOIS server directly instead of going through an
   intermediate web service like many others do.


Example
=======

```python
>>> import whois
>>> w = whois.whois('example.com')
>>> w.expiration_date  # dates converted to datetime object
datetime.datetime(2022, 8, 13, 4, 0)
>>> w.text  # the content downloaded from whois server
u'\nDomain Name: EXAMPLE.COM
Registry Domain ID: 2336799_DOMAIN_COM-VRSN
...'

>>> print(w)  # print values of all found attributes    
{
  "creation_date": "1995-08-14 04:00:00",
  "expiration_date": "2022-08-13 04:00:00",
  "updated_date": "2021-08-14 07:01:44",
  "domain_name": "EXAMPLE.COM",
  "name_servers": [
      "A.IANA-SERVERS.NET",
      "B.IANA-SERVERS.NET"
  ],
  ...
```

Install
=======

Install from pypi:

```bash
pip install python-whois
```

Or checkout latest version from repository:

```bash
git clone git@github.com:richardpenman/whois.git
pip install -r requirements.txt
```

Run test cases:

```bash
python -m pytest
```

Problems?
=========

Pull requests are welcome! 

Thanks to the many who have sent patches for additional TLDs. If you want to add or fix a TLD it's quite straightforward. 
See example domains in [whois/parser.py](https://github.com/richardpenman/whois/blob/master/whois/parser.py)

Basically each TLD has a similar format to the following:

```python
class WhoisOrg(WhoisEntry):
  """Whois parser for .org domains
  """
  regex = {
    'domain_name':      'Domain Name: *(.+)',
    'registrar':        'Registrar: *(.+)',
    'whois_server':     'Whois Server: *(.+)',
    ...
  }

  def __init__(self, domain, text):
    if text.strip() == 'NOT FOUND':
      raise PywhoisError(text)
    else:
      WhoisEntry.__init__(self, domain, text)
```

            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/richardpenman/whois",
    "name": "python-whois",
    "maintainer": null,
    "docs_url": null,
    "requires_python": null,
    "maintainer_email": null,
    "keywords": "whois, python",
    "author": "Richard Penman",
    "author_email": "richard.penman@gmail.com",
    "download_url": "https://files.pythonhosted.org/packages/8c/2f/6d3d93e7f611b5680fc15e37024fef33fe1fcbbe7717313d088cabdf5613/python_whois-0.9.4.tar.gz",
    "platform": null,
    "description": "Goal\n====\n\n-  Create a simple importable Python module which will produce parsed\n   WHOIS data for a given domain.\n-  Able to extract data for all the popular TLDs (com, org, net, ...)\n-  Query a WHOIS server directly instead of going through an\n   intermediate web service like many others do.\n\n\nExample\n=======\n\n```python\n>>> import whois\n>>> w = whois.whois('example.com')\n>>> w.expiration_date  # dates converted to datetime object\ndatetime.datetime(2022, 8, 13, 4, 0)\n>>> w.text  # the content downloaded from whois server\nu'\\nDomain Name: EXAMPLE.COM\nRegistry Domain ID: 2336799_DOMAIN_COM-VRSN\n...'\n\n>>> print(w)  # print values of all found attributes    \n{\n  \"creation_date\": \"1995-08-14 04:00:00\",\n  \"expiration_date\": \"2022-08-13 04:00:00\",\n  \"updated_date\": \"2021-08-14 07:01:44\",\n  \"domain_name\": \"EXAMPLE.COM\",\n  \"name_servers\": [\n      \"A.IANA-SERVERS.NET\",\n      \"B.IANA-SERVERS.NET\"\n  ],\n  ...\n```\n\nInstall\n=======\n\nInstall from pypi:\n\n```bash\npip install python-whois\n```\n\nOr checkout latest version from repository:\n\n```bash\ngit clone git@github.com:richardpenman/whois.git\npip install -r requirements.txt\n```\n\nRun test cases:\n\n```bash\npython -m pytest\n```\n\nProblems?\n=========\n\nPull requests are welcome! \n\nThanks to the many who have sent patches for additional TLDs. If you want to add or fix a TLD it's quite straightforward. \nSee example domains in [whois/parser.py](https://github.com/richardpenman/whois/blob/master/whois/parser.py)\n\nBasically each TLD has a similar format to the following:\n\n```python\nclass WhoisOrg(WhoisEntry):\n  \"\"\"Whois parser for .org domains\n  \"\"\"\n  regex = {\n    'domain_name':      'Domain Name: *(.+)',\n    'registrar':        'Registrar: *(.+)',\n    'whois_server':     'Whois Server: *(.+)',\n    ...\n  }\n\n  def __init__(self, domain, text):\n    if text.strip() == 'NOT FOUND':\n      raise PywhoisError(text)\n    else:\n      WhoisEntry.__init__(self, domain, text)\n```\n",
    "bugtrack_url": null,
    "license": "MIT",
    "summary": "Whois querying and parsing of domain registration information.",
    "version": "0.9.4",
    "project_urls": {
        "Homepage": "https://github.com/richardpenman/whois"
    },
    "split_keywords": [
        "whois",
        " python"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "23adc03f9618486ffb07c67f443012374f1acf3781074e0935bff553a87eb6eb",
                "md5": "750f8d6e5f807da3c044407d7bf9cac1",
                "sha256": "17d60f25524fc811a1f6a66f0298c1e5534551d7a01a77dd5f6406426da734e1"
            },
            "downloads": -1,
            "filename": "python_whois-0.9.4-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "750f8d6e5f807da3c044407d7bf9cac1",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": null,
            "size": 103343,
            "upload_time": "2024-04-26T09:22:23",
            "upload_time_iso_8601": "2024-04-26T09:22:23.510418Z",
            "url": "https://files.pythonhosted.org/packages/23/ad/c03f9618486ffb07c67f443012374f1acf3781074e0935bff553a87eb6eb/python_whois-0.9.4-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "8c2f6d3d93e7f611b5680fc15e37024fef33fe1fcbbe7717313d088cabdf5613",
                "md5": "b671b9ff3f92a7f7cbd9b3656ada8c63",
                "sha256": "77bc7347bf815d65ccd196711c29837652f07585aedad3c3c04dd885651fd7a7"
            },
            "downloads": -1,
            "filename": "python_whois-0.9.4.tar.gz",
            "has_sig": false,
            "md5_digest": "b671b9ff3f92a7f7cbd9b3656ada8c63",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": null,
            "size": 110584,
            "upload_time": "2024-04-26T09:22:25",
            "upload_time_iso_8601": "2024-04-26T09:22:25.530772Z",
            "url": "https://files.pythonhosted.org/packages/8c/2f/6d3d93e7f611b5680fc15e37024fef33fe1fcbbe7717313d088cabdf5613/python_whois-0.9.4.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-04-26 09:22:25",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "richardpenman",
    "github_project": "whois",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "requirements": [
        {
            "name": "python-dateutil",
            "specs": [
                [
                    "==",
                    "2.9.0.post0"
                ]
            ]
        }
    ],
    "lcname": "python-whois"
}
        
Elapsed time: 0.54474s