Mock travel APIs to use to stub out the real APIs. Used for example in the Taxi Slack Bot app.
- GET /taxis - a list of all taxis
{
"meta":{
"count": 2,
"links":{
"self": "https://mock-travel-apis.herokuapp.com/taxis"
}
},
"data":[
{
"state": "free",
"name": "hyundai",
"location": {
"lon": 3.703,
"lat": 40.41
},
"city": "madrid"
},
{
"state": "free",
"name": "fiat",
"location": {
"lon": 2.1734,
"lat": 41.38
},
"city": "barcelona"
},
...
]
}
- GET /taxis/<city> - a list of all taxis in a city
{
"meta":{
"count": 2,
"links":{
"self": "https://mock-travel-apis.herokuapp.com/taxis"
}
},
"data":[
{
"state": "free",
"name": "hyundai",
"location": {
"lon": 3.703,
"lat": 40.41
},
"city": "madrid"
},
{
"state": "free",
"name": "fiat",
"location": {
"lon": 3.732,
"lat": 40.51
},
"city": "madrid"
},
...
]
}
- GET /taxis/<city>/<taxi_id> - details for a given taxi
{
"meta":{
"count": 1,
"links":{
"self": "https://mock-travel-apis.herokuapp.com/taxis"
}
},
"data":[
{
"state": "free",
"name": "hyundai",
"location": {
"lon": 3.703,
"lat": 40.41
},
"city": "madrid"
},
...
]
}
- POST /taxis/<city>/<taxi_id> - book a given taxi
{
"meta":{
"count": 1,
"links":{
"self": "https://mock-travel-apis.herokuapp.com/taxis"
}
},
"data":[
{
"state": "hired",
"name": "hyundai",
"location": {
"lon": 3.703,
"lat": 40.41
},
"city": "madrid"
},
...
]
}
These instructions will get you a copy of the project up and running on your local machine for development and testing purposes.
What you will need:
- python 3.6
- pip
- pipenv
To run it locally:
- install the requirements
pipenv install
- run the server
pipenv run python server.py
- you can call the API with the following requests:
GET localhost:8080/taxis
GET localhost:8080/taxis/madrid
GET localhost:8080/taxis/madrid/hyundai
POST localhost:8080/taxis/madrid/hyundai
- Bottle - A simple WSGI micro web-framework for Python
- Initial work - SamHeyman
This project is licensed under the MIT License - see the LICENSE.md file for details
With contribution from: