myinfo


Namemyinfo JSON
Version 1.1.1 PyPI version JSON
download
home_pageNone
SummaryA package to retrieve WHOIS and IP information
upload_time2024-10-17 17:47:36
maintainerNone
docs_urlNone
authorMrFidal
requires_python>=3.6
licenseNone
keywords
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # MyInfo

**MyInfo** is a Python library for retrieving and formatting WHOIS and IP geolocation information. It allows you to easily get domain-related data such as registrar, creation date, expiry date, and DNS information, as well as IP geolocation details like city, country, and organization.

## Features

- Fetch WHOIS information for a domain.
- Resolve a domain to its IP address.
- Retrieve geolocation information for an IP address.
- Clean and simple API for integration into any Python project.

## Installation

```bash
pip install myinfo
```

## Usage

You can use the package to retrieve both WHOIS and IP information for any domain.

### Example Usage

#### 1. WHOIS Information

To fetch and format WHOIS information for a domain : 

```python
import myinfo

# Get WHOIS information
domain = "google.com"
whois_info = myinfo.get_whois_info(domain)

# Check for any errors
if 'error' not in whois_info:
    # Format WHOIS information
    formatted_whois = myinfo.format_whois_info(whois_info)
    
    # Example of displaying some information
    print(f"Domain Name: {formatted_whois['domain_name']}")
    print(f"Registrar: {formatted_whois['registrar']}")
    print(f"Creation Date: {formatted_whois['creation_date']}")
    print(f"Registry Expiry Date: {formatted_whois['registry_expiry_date']}")
    print(f"Name Servers: {formatted_whois['name_servers']}")
else:
    print(whois_info['error'])
```

#### 2. IP Geolocation Information

To resolve a domain to its IP and retrieve geolocation information for that IP :

```python
import myinfo

# WHOIS Information
domain = "google.com"
whois_info = myinfo.get_whois_info(domain)
if 'error' not in whois_info:
    formatted_whois = myinfo.format_whois_info(whois_info)
    print(f"Domain Name: {formatted_whois['domain_name']}")
    print(f"Registry Expiry Date: {formatted_whois['registry_expiry_date']}")
else:
    print(whois_info['error'])

# IP Geolocation Information
ip_address = myinfo.resolve_domain_to_ip(domain)
if isinstance(ip_address, dict) and 'error' in ip_address:
    print(ip_address['error'])
else:
    ip_info = myinfo.get_ip_geolocation(ip_address)
    if 'error' not in ip_info:
        formatted_ip_info = myinfo.format_ip_info(ip_address, ip_info)
        print(f"IP Address: {formatted_ip_info['ip_address']}")
        print(f"City: {formatted_ip_info['city']}")
        print(f"Country: {formatted_ip_info['country']}")
        print(f"Organization: {formatted_ip_info['organization']}")
    else:
        print(ip_info['error'])

```

### Functions

#### `get_whois_info(domain)`
- Retrieves WHOIS information for the given domain.
- **Parameters:**
    - `domain` (str): The domain name to get WHOIS information for.
- **Returns:**
    - A dictionary containing the WHOIS information or an error message.

#### `format_whois_info(domain_info)`
- Formats WHOIS information into a readable dictionary.
- **Parameters:**
    - `domain_info` (dict): The raw WHOIS data retrieved from the `get_whois_info()` function.
- **Returns:**
    - A dictionary containing formatted WHOIS data.

#### `resolve_domain_to_ip(domain)`
- Resolves a domain to its corresponding IP address.
- **Parameters:**
    - `domain` (str): The domain name to resolve.
- **Returns:**
    - The IP address (str) or an error message (dict).

#### `get_ip_geolocation(ip_address)`
- Retrieves geolocation information for a given IP address.
- **Parameters:**
    - `ip_address` (str): The IP address to get geolocation info for.
- **Returns:**
    - A dictionary containing IP geolocation information or an error message.

#### `format_ip_info(ip_info)`
- Formats IP geolocation information into a readable dictionary.
- **Parameters:**
    - `ip_info` (dict): The raw geolocation data retrieved from the `get_ip_geolocation()` function.
- **Returns:**
    - A dictionary containing formatted IP geolocation data.

## Example Output

For the domain `google.com` :

```
Domain Name: google.com  
Registrar: MarkMonitor Inc.  
Creation Date: 1997-09-15T04:00:00Z  
Registry Expiry Date: 2028-09-14T04:00:00Z  
Name Servers: ['NS1.GOOGLE.COM', 'NS2.GOOGLE.COM', 'NS3.GOOGLE.COM', 'NS4.GOOGLE.COM']

IP Address: 172.217.12.14  
City: Mountain View  
Country: US  
Organization: GOOGLE
```

## License

This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.

            

Raw data

            {
    "_id": null,
    "home_page": null,
    "name": "myinfo",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.6",
    "maintainer_email": null,
    "keywords": null,
    "author": "MrFidal",
    "author_email": "mrfidal@proton.me",
    "download_url": "https://files.pythonhosted.org/packages/3a/75/1950e4d80715ce3e7b58d6b52fead07046461d3eb6ea199d9e0021520426/myinfo-1.1.1.tar.gz",
    "platform": null,
    "description": "# MyInfo\r\n\r\n**MyInfo** is a Python library for retrieving and formatting WHOIS and IP geolocation information. It allows you to easily get domain-related data such as registrar, creation date, expiry date, and DNS information, as well as IP geolocation details like city, country, and organization.\r\n\r\n## Features\r\n\r\n- Fetch WHOIS information for a domain.\r\n- Resolve a domain to its IP address.\r\n- Retrieve geolocation information for an IP address.\r\n- Clean and simple API for integration into any Python project.\r\n\r\n## Installation\r\n\r\n```bash\r\npip install myinfo\r\n```\r\n\r\n## Usage\r\n\r\nYou can use the package to retrieve both WHOIS and IP information for any domain.\r\n\r\n### Example Usage\r\n\r\n#### 1. WHOIS Information\r\n\r\nTo fetch and format WHOIS information for a domain : \r\n\r\n```python\r\nimport myinfo\r\n\r\n# Get WHOIS information\r\ndomain = \"google.com\"\r\nwhois_info = myinfo.get_whois_info(domain)\r\n\r\n# Check for any errors\r\nif 'error' not in whois_info:\r\n    # Format WHOIS information\r\n    formatted_whois = myinfo.format_whois_info(whois_info)\r\n    \r\n    # Example of displaying some information\r\n    print(f\"Domain Name: {formatted_whois['domain_name']}\")\r\n    print(f\"Registrar: {formatted_whois['registrar']}\")\r\n    print(f\"Creation Date: {formatted_whois['creation_date']}\")\r\n    print(f\"Registry Expiry Date: {formatted_whois['registry_expiry_date']}\")\r\n    print(f\"Name Servers: {formatted_whois['name_servers']}\")\r\nelse:\r\n    print(whois_info['error'])\r\n```\r\n\r\n#### 2. IP Geolocation Information\r\n\r\nTo resolve a domain to its IP and retrieve geolocation information for that IP :\r\n\r\n```python\r\nimport myinfo\r\n\r\n# WHOIS Information\r\ndomain = \"google.com\"\r\nwhois_info = myinfo.get_whois_info(domain)\r\nif 'error' not in whois_info:\r\n    formatted_whois = myinfo.format_whois_info(whois_info)\r\n    print(f\"Domain Name: {formatted_whois['domain_name']}\")\r\n    print(f\"Registry Expiry Date: {formatted_whois['registry_expiry_date']}\")\r\nelse:\r\n    print(whois_info['error'])\r\n\r\n# IP Geolocation Information\r\nip_address = myinfo.resolve_domain_to_ip(domain)\r\nif isinstance(ip_address, dict) and 'error' in ip_address:\r\n    print(ip_address['error'])\r\nelse:\r\n    ip_info = myinfo.get_ip_geolocation(ip_address)\r\n    if 'error' not in ip_info:\r\n        formatted_ip_info = myinfo.format_ip_info(ip_address, ip_info)\r\n        print(f\"IP Address: {formatted_ip_info['ip_address']}\")\r\n        print(f\"City: {formatted_ip_info['city']}\")\r\n        print(f\"Country: {formatted_ip_info['country']}\")\r\n        print(f\"Organization: {formatted_ip_info['organization']}\")\r\n    else:\r\n        print(ip_info['error'])\r\n\r\n```\r\n\r\n### Functions\r\n\r\n#### `get_whois_info(domain)`\r\n- Retrieves WHOIS information for the given domain.\r\n- **Parameters:**\r\n    - `domain` (str): The domain name to get WHOIS information for.\r\n- **Returns:**\r\n    - A dictionary containing the WHOIS information or an error message.\r\n\r\n#### `format_whois_info(domain_info)`\r\n- Formats WHOIS information into a readable dictionary.\r\n- **Parameters:**\r\n    - `domain_info` (dict): The raw WHOIS data retrieved from the `get_whois_info()` function.\r\n- **Returns:**\r\n    - A dictionary containing formatted WHOIS data.\r\n\r\n#### `resolve_domain_to_ip(domain)`\r\n- Resolves a domain to its corresponding IP address.\r\n- **Parameters:**\r\n    - `domain` (str): The domain name to resolve.\r\n- **Returns:**\r\n    - The IP address (str) or an error message (dict).\r\n\r\n#### `get_ip_geolocation(ip_address)`\r\n- Retrieves geolocation information for a given IP address.\r\n- **Parameters:**\r\n    - `ip_address` (str): The IP address to get geolocation info for.\r\n- **Returns:**\r\n    - A dictionary containing IP geolocation information or an error message.\r\n\r\n#### `format_ip_info(ip_info)`\r\n- Formats IP geolocation information into a readable dictionary.\r\n- **Parameters:**\r\n    - `ip_info` (dict): The raw geolocation data retrieved from the `get_ip_geolocation()` function.\r\n- **Returns:**\r\n    - A dictionary containing formatted IP geolocation data.\r\n\r\n## Example Output\r\n\r\nFor the domain `google.com` :\r\n\r\n```\r\nDomain Name: google.com  \r\nRegistrar: MarkMonitor Inc.  \r\nCreation Date: 1997-09-15T04:00:00Z  \r\nRegistry Expiry Date: 2028-09-14T04:00:00Z  \r\nName Servers: ['NS1.GOOGLE.COM', 'NS2.GOOGLE.COM', 'NS3.GOOGLE.COM', 'NS4.GOOGLE.COM']\r\n\r\nIP Address: 172.217.12.14  \r\nCity: Mountain View  \r\nCountry: US  \r\nOrganization: GOOGLE\r\n```\r\n\r\n## License\r\n\r\nThis project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.\r\n",
    "bugtrack_url": null,
    "license": null,
    "summary": "A package to retrieve WHOIS and IP information",
    "version": "1.1.1",
    "project_urls": null,
    "split_keywords": [],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "0bff56332a8d8d04b1e6081ddb228fb817c409f69ed75f6338e0cf5781b835e0",
                "md5": "5e6bfcadf57ac33d2abf5317677d03e4",
                "sha256": "9828c20c26c266f3092d6747ed03ca26e20990f35933b0dbbe4b9f60f27216ab"
            },
            "downloads": -1,
            "filename": "myinfo-1.1.1-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "5e6bfcadf57ac33d2abf5317677d03e4",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.6",
            "size": 3709,
            "upload_time": "2024-10-17T17:47:33",
            "upload_time_iso_8601": "2024-10-17T17:47:33.865762Z",
            "url": "https://files.pythonhosted.org/packages/0b/ff/56332a8d8d04b1e6081ddb228fb817c409f69ed75f6338e0cf5781b835e0/myinfo-1.1.1-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "3a751950e4d80715ce3e7b58d6b52fead07046461d3eb6ea199d9e0021520426",
                "md5": "6dcc7f24bd29bb6df634ca33d24a726a",
                "sha256": "7020d1e5a647f70943d3a644cab0857b33b7585214094aea6aa3a7d1d508f4a0"
            },
            "downloads": -1,
            "filename": "myinfo-1.1.1.tar.gz",
            "has_sig": false,
            "md5_digest": "6dcc7f24bd29bb6df634ca33d24a726a",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.6",
            "size": 3504,
            "upload_time": "2024-10-17T17:47:36",
            "upload_time_iso_8601": "2024-10-17T17:47:36.832368Z",
            "url": "https://files.pythonhosted.org/packages/3a/75/1950e4d80715ce3e7b58d6b52fead07046461d3eb6ea199d9e0021520426/myinfo-1.1.1.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-10-17 17:47:36",
    "github": false,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "lcname": "myinfo"
}
        
Elapsed time: 1.59881s