semvec/pypi-packages huggingface dataset:
latlongtimezone-api 0.1.91
Get timezone, locale, and location based on the IP address to use in your requests
License: MIT
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

# 🌍 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.