Upload API Flight data
APIUploadFlightData
Bases: APIUploadInternal
Interface to upload flight data to server
Source code in src/rmlab/api/upload/flight_data.py
14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 |
|
upload_flights(scen_id, items, *, citysector_id=None, sector_id=None)
async
Upload a set of flights defined in a file.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
scen_id | int | Scenario ID | required |
items | Union[str, list] | A filename (.csv or .json) or list of filenames (.json) defining the flights | required |
citysector_id | Optional[str] | A citysector ID if all flights belong to the same citysector. Defaults to None. | None |
sector_id | Optional[str] | A sector ID if all flights belong to the same sector. Defaults to None. | None |
Arguments citysector_id
and sector_id
are always optional. If any of them provided, concurrent uploads of flights files belonging to different citysectors/sectors are allowed.
Where an item can refer to: * a CSV file, for instance:
Airline,Aircraft,Origin,Destination,Flight number,On sale date,Departure date,Departure time,Duration
MyCarrier,Airbus A320-b,MAD,GVA,2277,2022-04-01,2022-05-15,T16:30,T02:00
MyCarrier,Airbus A320-b,MAD,GVA,2277,2022-04-01,2022-05-17,T20:30,T02:00
- a JSON file, for instance:
[ {"airline": "MyCarrier", "aircraft": "Airbus A320-b", "origin": "MAD", "destination": "GVA", "flight_number": "2277", "on_sale_date": "2022-04-01", "departure_date": "2022-05-15", "departure_time": "T16:30", "duration": "T02:00", }, {"airline": "MyCarrier", "aircraft": "Airbus A320-b", "origin": "MAD", "destination": "GVA", "flight_number": "2277", "on_sale_date": "2022-04-01", "departure_date": "2022-05-17", "departure_time": "T20:30", "duration": "T02:00", }, ]
- a list of json filenames like the previous.
Source code in src/rmlab/api/upload/flight_data.py
17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 |
|
upload_flights_data(scen_id, flights_data, *, citysector_id=None, sector_id=None)
async
Upload flight data of multiple flights belonging to a citysector or sector to server.
Any previous existing data is overwritten. At least citysector_id
and/or sector_id
associated to the flights must be defined.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
scen_id | int | Scenario ID | required |
flights_data | List[Union[FlightDataBooks, FlightDataThresholdSettings, FlightDataPricePerSeatSettings]] | List of flights data to upload. | required |
citysector_id | Optional[str] | Target citysector ID. Defaults to None. | None |
sector_id | Optional[str] | Target sector ID. Defaults to None. | None |
Raises:
Type | Description |
---|---|
ValueError | If none of |
ValueError | If one of flight data list elements has incorrect type. |
MultipleError | If several of flight data list elements have incorrect types. |
Source code in src/rmlab/api/upload/flight_data.py
59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 |
|