locaspy


Namelocaspy JSON
Version 1.0.1 PyPI version JSON
download
home_pagehttps://mrfidal.in/basic-pip-package/locaspy
SummaryA tool for fetching location, weather, and map link based on IP address.
upload_time2024-06-19 10:18:50
maintainerNone
docs_urlNone
authorFidal
requires_python>=3.6
licenseNone
keywords
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # locaspy

locaspy is a Python package designed for retrieving location-based information such as geographical coordinates, weather conditions, ISP details, and more, using an IP address as input.

## Benefits

- ***Convenience*** : Easily retrieve detailed information about any IP address.
- ***Flexibility*** : Retrieve specific details such as weather, location, ISP, and more.
- ***Integration*** : Useful for integration into applications needing location-based services.
- ***Accuracy*** : Utilizes reliable APIs to provide accurate information.

## Who Would Benefit?

- ***Developers*** : Integrate location-based features into applications.
- ***Network Administrators*** : Quickly gather IP-related details.
- ***Security Analysts*** : Obtain context about IP addresses during investigations.

## Installation

You can install locaspy via pip:

```bash
pip install locaspy
```

## Usage
### Overview

- locaspy provides functions to fetch various types of information based on an IP address.

<b>How do you print your IP address?</b>
```python
import locaspy

my_ip = locaspy.get_my_ip()
print("My IP Address:", my_ip)
```
<b>Here's how you can use the locaspy package to print all available information based on the user's IP address:</b>
```python
import locaspy

# Get the user's IP address
ip_address = locaspy.get_ip()

# Get all information based on the IP address
info = locaspy.get_data(ip_address)

# Print all information
print("IP Address:", info["ip_address"])
print("Google Maps Link:", info["map_link"])
print("Location:")
print(f"  City: {info['city']}")
print(f"  Region: {info['region']}")
print(f"  Country: {info['country']}")
print(f"  Latitude: {info['latitude']}")
print(f"  Longitude: {info['longitude']}")
print(f"  Timezone: {info['timezone']}")
print(f"  Country Code: {info['country_code']}")
print(f"  Country Capital: {info['country_capital']}")
print(f"  ISP: {info['isp']}")
print(f"  ASN: {info['asn']}")
print(f"  Organization: {info['organization']}")
print(f"  Postal Code: {info['postal']}")
print(f"  UTC Offset: {info['utc_offset']}")
print(f"  Continent: {info['continent']}")
print(f"  Currency: {info['currency']}")
print(f"  Languages: {info['languages']}")
print("Weather:")
print(f"  Condition: {info['weather_condition']}")
print(f"  Temperature: {info['temperature']}°C")
print(f"  Wind Speed: {info['wind_speed']} km/h")
```

### Example Usages

<b>Get Google Maps Link</b>
```python
import locaspy

ip_address = input("Enter your IP: ")
map_link = locaspy.get_data(ip_address, "map")
print("Google Maps Link:", map_link)
```

<b>Get Weather Information</b>

```python
import locaspy

ip_address = input("Enter your IP: ")
weather_info = locaspy.get_data(ip_address, "weather")
print("Weather Information:", weather_info)
```

<b>Get Location Details</b>
```python
import locaspy

ip_address = input("Enter your IP: ")
location_info = locaspy.get_data(ip_address, "location")
print("Location Details:\n", location_info)
```

<b>Get ISP Information</b>
```python
import locaspy

ip_address = input("Enter your IP: ")
isp_info = locaspy.get_data(ip_address, "isp")
print("ISP Information:", isp_info)
```

<b>Get ASN Information</b>
```python
import locaspy

ip_address = input("Enter your IP: ")
asn_info = locaspy.get_data(ip_address, "asn")
print("ASN Information:", asn_info)
```

<b>Get Postal Code</b>
```python
import locaspy

ip_address = input("Enter your IP: ")
postal_code = locaspy.get_data(ip_address, "postal")
print("Postal Code:", postal_code)
```

<b>Get Continent</b>
```python
import locaspy

ip_address = input("Enter your IP: ")
continent = locaspy.get_data(ip_address, "continent")
print("Continent:", continent)
```

<b>Get Currency<b>
```python
import locaspy

ip_address = input("Enter your IP: ")
currency = locaspy.get_data(ip_address, "currency")
print("Currency:", currency)
```

<b>Get Languages</b>
```python
import locaspy

ip_address = input("Enter your IP: ")
languages = locaspy.get_data(ip_address, "languages")
print("Languages:", languages)
```

<b>To save all data in a single file</b>
```python
import locaspy

# Get the user's IP address
ip_address = locaspy.get_ip()

# Get all information based on the IP address
info = locaspy.get_data(ip_address)

# Define the file path
file_path = "data.txt"

# Open the file in write mode and write the information
with open(file_path, "w") as file:
    file.write(f"IP Address: {info['ip_address']}\n")
    file.write(f"Google Maps Link: {info['map_link']}\n")
    file.write("Location:\n")
    file.write(f"  City: {info['city']}\n")
    file.write(f"  Region: {info['region']}\n")
    file.write(f"  Country: {info['country']}\n")
    file.write(f"  Latitude: {info['latitude']}\n")
    file.write(f"  Longitude: {info['longitude']}\n")
    file.write(f"  Timezone: {info['timezone']}\n")
    file.write(f"  Country Code: {info['country_code']}\n")
    file.write(f"  Country Capital: {info['country_capital']}\n")
    file.write(f"  ISP: {info['isp']}\n")
    file.write(f"  ASN: {info['asn']}\n")
    file.write(f"  Organization: {info['organization']}\n")
    file.write(f"  Postal Code: {info['postal']}\n")
    file.write(f"  UTC Offset: {info['utc_offset']}\n")
    file.write(f"  Continent: {info['continent']}\n")
    file.write(f"  Currency: {info['currency']}\n")
    file.write(f"  Languages: {info['languages']}\n")
    file.write("Weather:\n")
    file.write(f"  Condition: {info['weather_condition']}\n")
    file.write(f"  Temperature: {info['temperature']}°C\n")
    file.write(f"  Wind Speed: {info['wind_speed']} km/h\n")

# Print confirmation message
print(f"Data has been saved to {file_path}")
```

## Thanks

Thank you for using locaspy! We appreciate your interest in our tool and hope it meets your needs. 

## Additional Information

For any issues, suggestions, or contributions, please visit our [GitHub repository](https://github.com/ByteBreach/locaspy) 

We welcome and encourage contributions from the community. Whether it's reporting a bug, suggesting a feature, or improving the documentation, your feedback is valuable and helps us improve the project.

### License

This project is licensed under the MIT License - see the [LICENSE](https://github.com/ByteBreach/locaspy/LICENSE) file for details.

### Acknowledgements

We would like to acknowledge the following libraries and resources that made this project possible:
- [requests](https://pypi.org/project/requests/)
- [ipapi](https://ipapi.co/)
- [open-meteo](https://open-meteo.com/)

Thank you again for your support!

            

Raw data

            {
    "_id": null,
    "home_page": "https://mrfidal.in/basic-pip-package/locaspy",
    "name": "locaspy",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.6",
    "maintainer_email": null,
    "keywords": null,
    "author": "Fidal",
    "author_email": "mrfidal@proton.me",
    "download_url": "https://files.pythonhosted.org/packages/2b/b6/3a99285424490911df9af8b6d930e1c37691b92b00b90c4709e67e9265f3/locaspy-1.0.1.tar.gz",
    "platform": null,
    "description": "# locaspy\r\n\r\nlocaspy is a Python package designed for retrieving location-based information such as geographical coordinates, weather conditions, ISP details, and more, using an IP address as input.\r\n\r\n## Benefits\r\n\r\n- ***Convenience*** : Easily retrieve detailed information about any IP address.\r\n- ***Flexibility*** : Retrieve specific details such as weather, location, ISP, and more.\r\n- ***Integration*** : Useful for integration into applications needing location-based services.\r\n- ***Accuracy*** : Utilizes reliable APIs to provide accurate information.\r\n\r\n## Who Would Benefit?\r\n\r\n- ***Developers*** : Integrate location-based features into applications.\r\n- ***Network Administrators*** : Quickly gather IP-related details.\r\n- ***Security Analysts*** : Obtain context about IP addresses during investigations.\r\n\r\n## Installation\r\n\r\nYou can install locaspy via pip:\r\n\r\n```bash\r\npip install locaspy\r\n```\r\n\r\n## Usage\r\n### Overview\r\n\r\n- locaspy provides functions to fetch various types of information based on an IP address.\r\n\r\n<b>How do you print your IP address?</b>\r\n```python\r\nimport locaspy\r\n\r\nmy_ip = locaspy.get_my_ip()\r\nprint(\"My IP Address:\", my_ip)\r\n```\r\n<b>Here's how you can use the locaspy package to print all available information based on the user's IP address:</b>\r\n```python\r\nimport locaspy\r\n\r\n# Get the user's IP address\r\nip_address = locaspy.get_ip()\r\n\r\n# Get all information based on the IP address\r\ninfo = locaspy.get_data(ip_address)\r\n\r\n# Print all information\r\nprint(\"IP Address:\", info[\"ip_address\"])\r\nprint(\"Google Maps Link:\", info[\"map_link\"])\r\nprint(\"Location:\")\r\nprint(f\"  City: {info['city']}\")\r\nprint(f\"  Region: {info['region']}\")\r\nprint(f\"  Country: {info['country']}\")\r\nprint(f\"  Latitude: {info['latitude']}\")\r\nprint(f\"  Longitude: {info['longitude']}\")\r\nprint(f\"  Timezone: {info['timezone']}\")\r\nprint(f\"  Country Code: {info['country_code']}\")\r\nprint(f\"  Country Capital: {info['country_capital']}\")\r\nprint(f\"  ISP: {info['isp']}\")\r\nprint(f\"  ASN: {info['asn']}\")\r\nprint(f\"  Organization: {info['organization']}\")\r\nprint(f\"  Postal Code: {info['postal']}\")\r\nprint(f\"  UTC Offset: {info['utc_offset']}\")\r\nprint(f\"  Continent: {info['continent']}\")\r\nprint(f\"  Currency: {info['currency']}\")\r\nprint(f\"  Languages: {info['languages']}\")\r\nprint(\"Weather:\")\r\nprint(f\"  Condition: {info['weather_condition']}\")\r\nprint(f\"  Temperature: {info['temperature']}\u00c2\u00b0C\")\r\nprint(f\"  Wind Speed: {info['wind_speed']} km/h\")\r\n```\r\n\r\n### Example Usages\r\n\r\n<b>Get Google Maps Link</b>\r\n```python\r\nimport locaspy\r\n\r\nip_address = input(\"Enter your IP: \")\r\nmap_link = locaspy.get_data(ip_address, \"map\")\r\nprint(\"Google Maps Link:\", map_link)\r\n```\r\n\r\n<b>Get Weather Information</b>\r\n\r\n```python\r\nimport locaspy\r\n\r\nip_address = input(\"Enter your IP: \")\r\nweather_info = locaspy.get_data(ip_address, \"weather\")\r\nprint(\"Weather Information:\", weather_info)\r\n```\r\n\r\n<b>Get Location Details</b>\r\n```python\r\nimport locaspy\r\n\r\nip_address = input(\"Enter your IP: \")\r\nlocation_info = locaspy.get_data(ip_address, \"location\")\r\nprint(\"Location Details:\\n\", location_info)\r\n```\r\n\r\n<b>Get ISP Information</b>\r\n```python\r\nimport locaspy\r\n\r\nip_address = input(\"Enter your IP: \")\r\nisp_info = locaspy.get_data(ip_address, \"isp\")\r\nprint(\"ISP Information:\", isp_info)\r\n```\r\n\r\n<b>Get ASN Information</b>\r\n```python\r\nimport locaspy\r\n\r\nip_address = input(\"Enter your IP: \")\r\nasn_info = locaspy.get_data(ip_address, \"asn\")\r\nprint(\"ASN Information:\", asn_info)\r\n```\r\n\r\n<b>Get Postal Code</b>\r\n```python\r\nimport locaspy\r\n\r\nip_address = input(\"Enter your IP: \")\r\npostal_code = locaspy.get_data(ip_address, \"postal\")\r\nprint(\"Postal Code:\", postal_code)\r\n```\r\n\r\n<b>Get Continent</b>\r\n```python\r\nimport locaspy\r\n\r\nip_address = input(\"Enter your IP: \")\r\ncontinent = locaspy.get_data(ip_address, \"continent\")\r\nprint(\"Continent:\", continent)\r\n```\r\n\r\n<b>Get Currency<b>\r\n```python\r\nimport locaspy\r\n\r\nip_address = input(\"Enter your IP: \")\r\ncurrency = locaspy.get_data(ip_address, \"currency\")\r\nprint(\"Currency:\", currency)\r\n```\r\n\r\n<b>Get Languages</b>\r\n```python\r\nimport locaspy\r\n\r\nip_address = input(\"Enter your IP: \")\r\nlanguages = locaspy.get_data(ip_address, \"languages\")\r\nprint(\"Languages:\", languages)\r\n```\r\n\r\n<b>To save all data in a single file</b>\r\n```python\r\nimport locaspy\r\n\r\n# Get the user's IP address\r\nip_address = locaspy.get_ip()\r\n\r\n# Get all information based on the IP address\r\ninfo = locaspy.get_data(ip_address)\r\n\r\n# Define the file path\r\nfile_path = \"data.txt\"\r\n\r\n# Open the file in write mode and write the information\r\nwith open(file_path, \"w\") as file:\r\n    file.write(f\"IP Address: {info['ip_address']}\\n\")\r\n    file.write(f\"Google Maps Link: {info['map_link']}\\n\")\r\n    file.write(\"Location:\\n\")\r\n    file.write(f\"  City: {info['city']}\\n\")\r\n    file.write(f\"  Region: {info['region']}\\n\")\r\n    file.write(f\"  Country: {info['country']}\\n\")\r\n    file.write(f\"  Latitude: {info['latitude']}\\n\")\r\n    file.write(f\"  Longitude: {info['longitude']}\\n\")\r\n    file.write(f\"  Timezone: {info['timezone']}\\n\")\r\n    file.write(f\"  Country Code: {info['country_code']}\\n\")\r\n    file.write(f\"  Country Capital: {info['country_capital']}\\n\")\r\n    file.write(f\"  ISP: {info['isp']}\\n\")\r\n    file.write(f\"  ASN: {info['asn']}\\n\")\r\n    file.write(f\"  Organization: {info['organization']}\\n\")\r\n    file.write(f\"  Postal Code: {info['postal']}\\n\")\r\n    file.write(f\"  UTC Offset: {info['utc_offset']}\\n\")\r\n    file.write(f\"  Continent: {info['continent']}\\n\")\r\n    file.write(f\"  Currency: {info['currency']}\\n\")\r\n    file.write(f\"  Languages: {info['languages']}\\n\")\r\n    file.write(\"Weather:\\n\")\r\n    file.write(f\"  Condition: {info['weather_condition']}\\n\")\r\n    file.write(f\"  Temperature: {info['temperature']}\u00c2\u00b0C\\n\")\r\n    file.write(f\"  Wind Speed: {info['wind_speed']} km/h\\n\")\r\n\r\n# Print confirmation message\r\nprint(f\"Data has been saved to {file_path}\")\r\n```\r\n\r\n## Thanks\r\n\r\nThank you for using locaspy! We appreciate your interest in our tool and hope it meets your needs. \r\n\r\n## Additional Information\r\n\r\nFor any issues, suggestions, or contributions, please visit our [GitHub repository](https://github.com/ByteBreach/locaspy) \r\n\r\nWe welcome and encourage contributions from the community. Whether it's reporting a bug, suggesting a feature, or improving the documentation, your feedback is valuable and helps us improve the project.\r\n\r\n### License\r\n\r\nThis project is licensed under the MIT License - see the [LICENSE](https://github.com/ByteBreach/locaspy/LICENSE) file for details.\r\n\r\n### Acknowledgements\r\n\r\nWe would like to acknowledge the following libraries and resources that made this project possible:\r\n- [requests](https://pypi.org/project/requests/)\r\n- [ipapi](https://ipapi.co/)\r\n- [open-meteo](https://open-meteo.com/)\r\n\r\nThank you again for your support!\r\n",
    "bugtrack_url": null,
    "license": null,
    "summary": "A tool for fetching location, weather, and map link based on IP address.",
    "version": "1.0.1",
    "project_urls": {
        "Homepage": "https://mrfidal.in/basic-pip-package/locaspy"
    },
    "split_keywords": [],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "f9d7476899f9c3c8a120e36d75eb92d91be82b2ff3cd729df4aa51f4418d7c5a",
                "md5": "ab77b663832246cb75171ac1902fe258",
                "sha256": "569543e29cb7ae14afb1680b370b92bffdebad9bbad381a96901a9211a8f24eb"
            },
            "downloads": -1,
            "filename": "locaspy-1.0.1-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "ab77b663832246cb75171ac1902fe258",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.6",
            "size": 5053,
            "upload_time": "2024-06-19T10:18:46",
            "upload_time_iso_8601": "2024-06-19T10:18:46.390283Z",
            "url": "https://files.pythonhosted.org/packages/f9/d7/476899f9c3c8a120e36d75eb92d91be82b2ff3cd729df4aa51f4418d7c5a/locaspy-1.0.1-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "2bb63a99285424490911df9af8b6d930e1c37691b92b00b90c4709e67e9265f3",
                "md5": "82811c1c413d6e84d570db2e3d07253f",
                "sha256": "c5b3e9644f240615240cd21f069318457ee3e9e5ac0c28e6f96c8c61f619fbb9"
            },
            "downloads": -1,
            "filename": "locaspy-1.0.1.tar.gz",
            "has_sig": false,
            "md5_digest": "82811c1c413d6e84d570db2e3d07253f",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.6",
            "size": 5220,
            "upload_time": "2024-06-19T10:18:50",
            "upload_time_iso_8601": "2024-06-19T10:18:50.299264Z",
            "url": "https://files.pythonhosted.org/packages/2b/b6/3a99285424490911df9af8b6d930e1c37691b92b00b90c4709e67e9265f3/locaspy-1.0.1.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-06-19 10:18:50",
    "github": false,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "lcname": "locaspy"
}
        
Elapsed time: 0.26340s