# 🌍 GeoLocation API
A simple API to retrieve timezone, locale, and geolocation data from an IP address. Perfect for enriching your application with accurate location-based accept-language and timezone details.
---
## 📦 Installation
Install the package using pip:
```bash
pip install latlongtimezone-api
```
---
## 🚀 Usage
Here's how to get started with the `GeoLocation` class:
```python
from geolocation import GeoLocation
# Initialize the GeoLocation class with a proxy (if needed)
geo = GeoLocation(proxy="http://user:pass@host:port")
# Fetch geolocation data
geolocation_data = geo.get_geolocation()
# Print the geolocation data
print(geolocation_data)
# Returns the following dictionary:
{
"lat": 48.8566,
"lon": 2.3522,
"timezone": "Europe/Paris",
"locale": "fr-FR",
"ip": "82.117.11.11"
}
```
---
## 🛠️ Features
- Fetch public IP address
- Retrieve latitude, longitude, timezone, and locale
- Cache results using Redis for faster subsequent lookups
---
## 📋 Requirements
To use this package, you'll need:
- Python 3.6+
- `requests` library
- `redis` library
- `python-dotenv` library
Install the necessary dependencies with:
```bash
pip install requests redis python-dotenv
```
---
## 🔧 Configuration
Set up your Redis and proxy configurations in a `.env` file:
```plaintext
REDIS_HOST=localhost
REDIS_PORT=6379
REDIS_DB=0
REDIS_PASSWORD=yourpassword
```
---
## 🌟 Contributing
Contributions are welcome! If you have suggestions or improvements, feel free to:
1. Open an issue to discuss the changes.
2. Submit a pull request with your enhancements.
---
## 👤 Author
**dormic97** - [GitHub Profile](https://github.com/pim97)
---
## 📝 License
This project is licensed under the MIT License. See the [LICENSE](LICENSE) file for details.
---
Happy coding! 🎉
---
This version includes improved formatting, readability, and a clear flow for anyone using the API.
Raw data
{
"_id": null,
"home_page": "https://github.com/pim97/requests-lat-long-timezone-locale-ip-api",
"name": "latlongtimezone-api",
"maintainer": null,
"docs_url": null,
"requires_python": null,
"maintainer_email": null,
"keywords": "ip, ip-api, ip-geolocation, ip-location, ip-address, ip-locator, ip-tracker, ip-geocoding, ip-api-geolocation, ip-api-location, ip-api-address, ip-api-locator, ip-api-tracker, ip-api-geocoding",
"author": "dormic97",
"author_email": "crozz-boy@hotmail.com",
"download_url": "https://files.pythonhosted.org/packages/01/c3/666c7216f76621c1b943471af82786d1fc7f821820e31bb9e5aaace2cd0e/latlongtimezone_api-0.1.91.tar.gz",
"platform": null,
"description": "# \ud83c\udf0d GeoLocation API\r\n\r\nA simple API to retrieve timezone, locale, and geolocation data from an IP address. Perfect for enriching your application with accurate location-based accept-language and timezone details.\r\n\r\n---\r\n\r\n## \ud83d\udce6 Installation\r\n\r\nInstall the package using pip:\r\n\r\n```bash\r\npip install latlongtimezone-api\r\n```\r\n\r\n---\r\n\r\n## \ud83d\ude80 Usage\r\n\r\nHere's how to get started with the `GeoLocation` class:\r\n\r\n```python\r\nfrom geolocation import GeoLocation\r\n\r\n# Initialize the GeoLocation class with a proxy (if needed)\r\ngeo = GeoLocation(proxy=\"http://user:pass@host:port\")\r\n\r\n# Fetch geolocation data\r\ngeolocation_data = geo.get_geolocation()\r\n\r\n# Print the geolocation data\r\nprint(geolocation_data)\r\n\r\n# Returns the following dictionary:\r\n{\r\n \"lat\": 48.8566,\r\n \"lon\": 2.3522,\r\n \"timezone\": \"Europe/Paris\",\r\n \"locale\": \"fr-FR\",\r\n \"ip\": \"82.117.11.11\"\r\n}\r\n\r\n```\r\n\r\n---\r\n\r\n## \ud83d\udee0\ufe0f Features\r\n\r\n- Fetch public IP address\r\n- Retrieve latitude, longitude, timezone, and locale\r\n- Cache results using Redis for faster subsequent lookups\r\n\r\n---\r\n\r\n## \ud83d\udccb Requirements\r\n\r\nTo use this package, you'll need:\r\n\r\n- Python 3.6+\r\n- `requests` library\r\n- `redis` library\r\n- `python-dotenv` library\r\n\r\nInstall the necessary dependencies with:\r\n\r\n```bash\r\npip install requests redis python-dotenv\r\n```\r\n\r\n---\r\n\r\n## \ud83d\udd27 Configuration\r\n\r\nSet up your Redis and proxy configurations in a `.env` file:\r\n\r\n```plaintext\r\nREDIS_HOST=localhost\r\nREDIS_PORT=6379\r\nREDIS_DB=0\r\nREDIS_PASSWORD=yourpassword\r\n```\r\n\r\n---\r\n\r\n## \ud83c\udf1f Contributing\r\n\r\nContributions are welcome! If you have suggestions or improvements, feel free to:\r\n\r\n1. Open an issue to discuss the changes.\r\n2. Submit a pull request with your enhancements.\r\n\r\n---\r\n\r\n## \ud83d\udc64 Author\r\n\r\n**dormic97** - [GitHub Profile](https://github.com/pim97)\r\n\r\n---\r\n\r\n## \ud83d\udcdd License\r\n\r\nThis project is licensed under the MIT License. See the [LICENSE](LICENSE) file for details.\r\n\r\n---\r\n\r\nHappy coding! \ud83c\udf89\r\n\r\n---\r\n\r\nThis version includes improved formatting, readability, and a clear flow for anyone using the API.\r\n",
"bugtrack_url": null,
"license": "MIT",
"summary": "Get timezone, locale, and location based on the IP address to use in your requests",
"version": "0.1.91",
"project_urls": {
"Homepage": "https://github.com/pim97/requests-lat-long-timezone-locale-ip-api"
},
"split_keywords": [
"ip",
" ip-api",
" ip-geolocation",
" ip-location",
" ip-address",
" ip-locator",
" ip-tracker",
" ip-geocoding",
" ip-api-geolocation",
" ip-api-location",
" ip-api-address",
" ip-api-locator",
" ip-api-tracker",
" ip-api-geocoding"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "de8ab629a3ab7a7b120f468b7982bce99dd0dea19e5ba1d8022a4909e0d1b209",
"md5": "1269367c24335f5d06fb14e1ce233cca",
"sha256": "826057aeefbab9cd08a7a9cfeee65889445e8196206c01e5f90a16ae419dabf1"
},
"downloads": -1,
"filename": "latlongtimezone_api-0.1.91-py3-none-any.whl",
"has_sig": false,
"md5_digest": "1269367c24335f5d06fb14e1ce233cca",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": null,
"size": 10128,
"upload_time": "2024-09-23T13:04:46",
"upload_time_iso_8601": "2024-09-23T13:04:46.611365Z",
"url": "https://files.pythonhosted.org/packages/de/8a/b629a3ab7a7b120f468b7982bce99dd0dea19e5ba1d8022a4909e0d1b209/latlongtimezone_api-0.1.91-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "01c3666c7216f76621c1b943471af82786d1fc7f821820e31bb9e5aaace2cd0e",
"md5": "26536e5ce59aff78c3aabb9144f53805",
"sha256": "0c13e1268b9b7b75d2281c82ad78460169565c6ab6759982ef6119274caf2eb3"
},
"downloads": -1,
"filename": "latlongtimezone_api-0.1.91.tar.gz",
"has_sig": false,
"md5_digest": "26536e5ce59aff78c3aabb9144f53805",
"packagetype": "sdist",
"python_version": "source",
"requires_python": null,
"size": 25740,
"upload_time": "2024-09-23T13:04:47",
"upload_time_iso_8601": "2024-09-23T13:04:47.915848Z",
"url": "https://files.pythonhosted.org/packages/01/c3/666c7216f76621c1b943471af82786d1fc7f821820e31bb9e5aaace2cd0e/latlongtimezone_api-0.1.91.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-09-23 13:04:47",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "pim97",
"github_project": "requests-lat-long-timezone-locale-ip-api",
"travis_ci": false,
"coveralls": false,
"github_actions": false,
"lcname": "latlongtimezone-api"
}