A robust FastAPI service that generates real-world addresses (verified via OpenStreetMap), paired with localized names and phone numbers. It is designed to be adaptive, handling various country input formats (e.g., "US", "America", "美国") and intelligently falling back if specific city/zip inputs are invalid.
- Real Addresses: Fetches actual physical addresses using OpenStreetMap (Nominatim).
- Adaptive Input: Smartly handles conflicts (e.g., wrong city for a country) by prioritizing the country and finding a real location within it.
- Multi-language Support: Accepts country names in English, Chinese ("美国"), and ISO codes.
- Localized Persona: Generates native-sounding names and phone numbers corresponding to the address.
- Deployment Ready: Includes
Dockerfileand configuration for easy deployment on Render.
- Install dependencies:
pip install -r requirements.txt
- Run the server:
uvicorn app.main:app --reload
- Access the API documentation at
http://localhost:8000/docs.
- Build the image:
docker build -t real-address-api . - Run the container:
docker run -p 8000:8000 real-address-api
Parameters:
country(required): Country name (e.g., "US", "China", "Germany", "美国").city(optional): Preferred city.zipcode(optional): Preferred zipcode.state(optional): Preferred state/province.
Example Request:
GET /api/generate?country=US&city=New%20York
Example Response:
{
"name": "John Doe",
"phone": "+1-555-0199",
"address": "44 West 63rd Street",
"city_state": "New York, New York",
"zipcode": "10023",
"country": "United States",
"full_address": "Hotel Empire, 44, West 63rd Street, Lincoln Square, New York, 10023, United States"
}- Create a new Web Service on Render.
- Connect this repository.
- Select Docker as the Runtime.
- Render will automatically build and deploy using the
Dockerfile.