Skip to main content

Simple taxi booking api

Project description

super-taxi-api

Simple api for taxi booking named as super-taxi

Dependencies

Installing

To install the api execute below command

pip install super-taxi-api

If you want to install from test org, for development mode use below

pip install -i https://test.pypi.org/simple/ super-taxi-api

Running

To run with rest api tick option which update system service time, Execute below in terminal to start the api

super-taxi-api

To run with system clock enable. This will internally start a clock which update the time tick

super-taxi-api --clock

APIs

Rest apis for book a taxi

POST /api/book

Pick the nearest available car to the customer location and return the total time taken to travel from the current car location to customer location then to customer destination.

  • Request payload
{
  "source": {
    "x": 0,
    "y": 0
  },
  "destination": {
    "x": 2,
    "y": 3
  }
}
  • Response payload
{
  "car_id": 1,
  "total_time": 10
}
  • All car are available initially, and become booked once it is assigned to a customer. It will remain booked until it reaches its destination, and immediately become available again.
  • In the event that there are more than one car near the customer location, your service should return the car with the smallest id.
  • Only one car be assigned to a customer, and only one customer to a car.
  • Cars can occupy the same spot, e.g. car 1 and 2 can be at point (1, 1) at the same time.
  • If there is no available car that can satisfy the request, your service should return an empty response, not an error

POST /api/tick

Advance service time by 1 time unit

PUT /api/reset

reset all cars data back to the initial state regardless of cars that are currently booked.

For test the service use basic_solution_checker.py

python3 basic_solution_checker.py

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

super-taxi-api-0.0.3.tar.gz (11.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

super_taxi_api-0.0.3-py3-none-any.whl (14.6 kB view details)

Uploaded Python 3

File details

Details for the file super-taxi-api-0.0.3.tar.gz.

File metadata

  • Download URL: super-taxi-api-0.0.3.tar.gz
  • Upload date:
  • Size: 11.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/47.1.0 requests-toolbelt/0.9.1 tqdm/4.48.2 CPython/3.8.4

File hashes

Hashes for super-taxi-api-0.0.3.tar.gz
Algorithm Hash digest
SHA256 45b41a8eb2e6d499b409b590e9148dca127595af38d56ea716f2ce396fd459c5
MD5 780f38408073c128b242b8ec0b731156
BLAKE2b-256 8243684640097738358e2fab831618061f7eed59282b70a286e7d496ed3b2d53

See more details on using hashes here.

File details

Details for the file super_taxi_api-0.0.3-py3-none-any.whl.

File metadata

  • Download URL: super_taxi_api-0.0.3-py3-none-any.whl
  • Upload date:
  • Size: 14.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/47.1.0 requests-toolbelt/0.9.1 tqdm/4.48.2 CPython/3.8.4

File hashes

Hashes for super_taxi_api-0.0.3-py3-none-any.whl
Algorithm Hash digest
SHA256 b84a56ab3fe5e9e5c7ad578771eacf59d656a29d90961103eb23f8eebef1aa0b
MD5 9ce043be8545f5c94d94143f6e61a415
BLAKE2b-256 414991a8ad777f0f8e7ccca687fdb15d39a4222754f8162c86bb11ef80797a78

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page