FastAPI dependency: get client IP device browser and geo data
Project description
ipagent
ipagent is a FastAPI dependency for extracting client IP address, device, browser, and geo-location data effortlessly.
Project Description
ipagent makes it simple to access detailed client metadata in your FastAPI endpoints, including:
- Automatically detects client IP
- Fetches geolocation info using the IP address
- Device and browser information
- Operating system
- Geolocation (city and country)
- Minimal and easy-to-use FastAPI dependency
This package provides a plug-and-play Depends function that integrates smoothly into any FastAPI project.
Installation
pip install ipagent
How to Use
from ipagent import get_client_info, ClientInfo
from fastapi import FastAPI, Depends
app = FastAPI()
@app.get('/')
async def user_data(user: ClientInfo = Depends(get_client_info)):
return user
Example Response
{
"ip_client": "31.110.210.10",
"device_type": "Desktop",
"browser": "Safari",
"browser_version": "18.1",
"os": "Mac OS X",
"os_version": "10.15.7",
"country": "Uzbekistan",
"region": "Tashkent",
"city": "Tashkent",
"latitude": 49.2615,
"longitude": 61.2177,
"timezone": "Asia/Tashkent",
"postal": null,
"org": "UNITEL LLC"
}
💡 Ideas for Future Improvements
We believe ipagent can grow into a powerful, flexible client metadata toolkit. Here are some feature ideas and
improvements we’re excited about — and if you’d like to contribute, we’d be happy to collaborate!
🙌 Contribute a New Feature
We’d love to see your ideas in action! Here’s how you can fork the project, add a new feature, and open a pull request:
1. Fork the Repository
Go to github.com/allncuz/ipagent and click the Fork button to create your own copy.
2. Clone Your Fork
git clone https://github.com/your-username/ipagent.git
cd ipagent
Together, let’s make ipagent the most useful and elegant client metadata tool for FastAPI developers.
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file ipagent-0.1.6.tar.gz.
File metadata
- Download URL: ipagent-0.1.6.tar.gz
- Upload date:
- Size: 16.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
8a15237d10abb6632aa8b95029f40b3cad8cf01196517ca306c4f14a6207741a
|
|
| MD5 |
c4c5dd1d4408857e0aaa31ae4aab67d4
|
|
| BLAKE2b-256 |
2956fc557385f9d9c41c851889283a878da204b28c91361aa5e041f2b11873e4
|
File details
Details for the file ipagent-0.1.6-py3-none-any.whl.
File metadata
- Download URL: ipagent-0.1.6-py3-none-any.whl
- Upload date:
- Size: 16.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
45de8b983ee77fb0115dbeea790fde97ec870d81d8abb9dd439399e7d3a734e7
|
|
| MD5 |
049e6dfa844abffe9c9617db75aab889
|
|
| BLAKE2b-256 |
8edde1a2aa624d4d2cf7cac39d41e707a196f8ab3b029ddf765ed957cd17454c
|