Skip to content

Flask server microservice to return pilot flight time limits depending on starting time and number of flight legs.

Notifications You must be signed in to change notification settings

vayfarer/flight_time_limit

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

flight_time_limit

Flask server microservice to return pilot flight time limits depending on starting time and number of flight legs.

How to use:

  1. Deploy the project on Google App Engine.
  2. Then access the microservice by sending HTTP GET requests to the project at:
    http://<GAE project domain name>/flight_time_limit?start_time=<time in 2400 format>&flight_legs=<number of flight legs between 1 and 4 inclusive>
    For example:
    http://YOUR_PROJECT_ADDRESS.appspot.com/flight_time_limit?start_time=1234&flight_legs=2
    The query parameters start_time and flight_legs are the input parameters. You may open the url on your web browser, which will return the flight time limit in the body of a HTTP response.
  3. The HTTP response from the microservice will include the flight time limit in the response body. Units are hours.

A means of accessing the microservice in python is provided as follows:

import requests


def get_flight_time_limit(start_time: str, legs: str):
    """GET Request to username microservice."""
    url = "http://<YOUR_PROJECT>.uw.r.appspot.com/flight_time_limit"
    url += f"?start_time={start_time}&flight_legs={legs}"
    print(url)
    try:
        response = requests.get(url, timeout=5)
        response.raise_for_status()
    except requests.ConnectionError as error:
        return error
    except requests.exceptions.HTTPError as error:
        return error
    return response.text


if __name__ == '__main__':
    print(get_flight_time_limit("1200", "2"))
    # expected result "11"

UML Sequence Diagram

UML diagram

About

Flask server microservice to return pilot flight time limits depending on starting time and number of flight legs.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages