|
| 1 | +from amadeus.client.decorator import Decorator |
| 2 | +from amadeus.travel.trip_parser_jobs._status import TripParserStatus |
| 3 | +from amadeus.travel.trip_parser_jobs._result import TripParserResult |
| 4 | + |
| 5 | + |
| 6 | +class TripParser(Decorator, object): |
| 7 | + def __init__(self, client): |
| 8 | + Decorator.__init__(self, client) |
| 9 | + |
| 10 | + def status(self, job_id): |
| 11 | + return TripParserStatus(self.client, job_id) |
| 12 | + |
| 13 | + def result(self, job_id): |
| 14 | + return TripParserResult(self.client, job_id) |
| 15 | + |
| 16 | + def post(self, body): |
| 17 | + ''' |
| 18 | + Sends the request for the parsing with the |
| 19 | + booking details and input parameters. |
| 20 | +
|
| 21 | + .. code-block:: python |
| 22 | +
|
| 23 | + amadeus.travel.trip_parser_jobs.post( |
| 24 | + '{ "data": { |
| 25 | + "type": "trip-parser-job", |
| 26 | + "content": : "base64string" }}' |
| 27 | +
|
| 28 | + You can call our helper functions with your booking details |
| 29 | + in a file or the content encoded in Base64 |
| 30 | +
|
| 31 | + .. code-block:: python |
| 32 | + amadeus.travel.trip_parser_jobs.post(amadeus.travel.from_file(path_to_file)) |
| 33 | + amadeus.travel.trip_parser_jobs.post(amadeus.travel.from_base64(base64)) |
| 34 | +
|
| 35 | + :rtype: amadeus.Response |
| 36 | + :raises amadeus.ResponseError: if the request could not be completed |
| 37 | + ''' |
| 38 | + return self.client.post('/v2/travel/trip-parser-jobs', body) |
0 commit comments