https://github.com/cumulus13/django_client_ip
Django middleware that retrieves the client IP address and optionally fetches geolocation data using ip-api.com.
https://github.com/cumulus13/django_client_ip
client client-ip django ip
Last synced: 7 months ago
JSON representation
Django middleware that retrieves the client IP address and optionally fetches geolocation data using ip-api.com.
- Host: GitHub
- URL: https://github.com/cumulus13/django_client_ip
- Owner: cumulus13
- License: mit
- Created: 2024-10-17T14:16:39.000Z (over 1 year ago)
- Default Branch: master
- Last Pushed: 2024-10-17T14:21:31.000Z (over 1 year ago)
- Last Synced: 2024-10-19T20:41:25.718Z (over 1 year ago)
- Topics: client, client-ip, django, ip
- Language: Python
- Homepage: https://github.com/cumulus13/django_client_ip
- Size: 2.93 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# django-client-ip
`django-client-ip` is a Django middleware that retrieves the client IP address and optionally fetches geolocation data using `ip-api.com`.
## Installation
1. Install the package using pip:
```bash
pip install django-client-ip
```
2. Add the middleware to your Django project in settings.py:
```python
MIDDLEWARE = [
# Other middlewares
'django_client_ip.GetClientIP',
]
```
## Usage
Once installed, every `request` object will have a `client_ip` attribute containing the IP address and geolocation data (if available).
## Author
[Hadi Cahyadi](mailto:cumulus13@gmail.com)
[](https://www.buymeacoffee.com/cumulus13)
[](https://ko-fi.com/cumulus13)
[Support me on Patreon](https://www.patreon.com/cumulus13)