Simple Python example of retrieving and parsing XML data.
Uses a Flask server to expose endpoints from which to retrieve information.
- Python 2.7
pip install -r requirements.txt
python server.py
The server will start on http://localhost:5000
.
- Path:
/api/weather/<id>
- Parameters:
- id: int An integer representing a municipality in Spain. A full list of municipities can be found in this Excel file.
- Returns: string
- The name of the municipality of given id.
- An error message if the municipality id is not valid.
- Examples:
> http://localhost:5000/api/weather/50297
Name: Zaragoza Municipality ID: 50297