Skip to content

Commit 49bcaca

Browse files
authored
Update travis code samples (#65)
* intro error * produce error * add exit when error * remove raise * print error msg * travis script exit when error * test build with correct call * minor update * keep raise error only * remove unused import * remove print error * revert flight offers search to correct call * fix travis script * intro dummy error to make build fail * fix dummy error
1 parent 43fa717 commit 49bcaca

File tree

21 files changed

+18
-36
lines changed

21 files changed

+18
-36
lines changed

.travis_script.sh

Lines changed: 18 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,22 @@
11
if [[ $TRAVIS_EVENT_TYPE == "pull_request" && $TRAVIS_PULL_REQUEST_BRANCH != "master" ]] ; then
2-
python examples/hotel_search/hotel_search.py
3-
python examples/flight_choice_prediction/flight_choice_prediction.py
4-
python examples/flight_offers_search/flight_offers_search.py
5-
python examples/hotel_ratings/hotel_ratings.py
6-
python examples/points_of_interest/points_of_interest.py
2+
python examples/hotel_search/hotel_search.py
3+
if [[ $? != 0 ]]; then exit 1 ; fi
4+
python examples/flight_choice_prediction/flight_choice_prediction.py
5+
if [[ $? != 0 ]]; then exit 1 ; fi
6+
python examples/flight_offers_search/flight_offers_search.py
7+
if [[ $? != 0 ]]; then exit 1 ; fi
8+
python examples/hotel_ratings/hotel_ratings.py
9+
if [[ $? != 0 ]]; then exit 1 ; fi
10+
python examples/points_of_interest/points_of_interest.py
11+
if [[ $? != 0 ]]; then exit 1 ; fi
712
fi
813
if [[ $TRAVIS_EVENT_TYPE == "push" && $TRAVIS_BRANCH == "master" ]] ; then
9-
for folder in examples/*/ ; do
10-
for file in "$folder"/* ; do
11-
if [[ $file == *.py ]]
12-
then
13-
python "$file"
14-
fi
15-
done
16-
done
14+
for folder in examples/*/ ; do
15+
for file in "$folder"/* ; do
16+
if [[ $file == *.py ]] ; then
17+
python "$file"
18+
if [[ $? != 0 ]]; then exit 1 ; fi
19+
fi
20+
done
21+
done
1722
fi

examples/ai_generated_photos/ai_generated_photos.py

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,5 @@
1313
except ImportError:
1414
import urllib
1515
urllib.urlretrieve(response.data['attachmentUri'], 'generated_image.jpg')
16-
17-
print(response.data)
1816
except ResponseError as error:
19-
print(error)
2017
raise error

examples/airline_code_lookup/airline_code_lookup.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,5 +9,4 @@
99
response = amadeus.reference_data.airlines.get(airlineCodes='BA')
1010
# print(response.data)
1111
except ResponseError as error:
12-
print(error)
1312
raise error

examples/airport_and_city_search/airport_and_city_search.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,5 +11,4 @@
1111
subType=Location.ANY)
1212
# print(response.data)
1313
except ResponseError as error:
14-
print(error)
1514
raise error

examples/airport_nearest_relevant_airport/airport_nearest_relevant_airport.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,5 +9,4 @@
99
response = amadeus.reference_data.locations.airports.get(longitude=49.000, latitude=2.55)
1010
# print(response.data)
1111
except ResponseError as error:
12-
print(error)
1312
raise error

examples/airport_on_time_performance/airport_on_time_performance.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,5 +9,4 @@
99
response = amadeus.airport.predictions.on_time.get(airportCode='JFK', date='2020-09-01')
1010
# print(response.data)
1111
except ResponseError as error:
12-
print(error)
1312
raise error

examples/flight_busiest_traveling_period/flight_busiest_traveling_period.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,5 +9,4 @@
99
response = amadeus.travel.analytics.air_traffic.busiest_period.get(cityCode='MAD', period='2017', direction='ARRIVING')
1010
# print(response.data)
1111
except ResponseError as error:
12-
print(error)
1312
raise error

examples/flight_cheapest_date_search/flight_cheapest_date_search.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,5 +9,4 @@
99
response = amadeus.shopping.flight_dates.get(origin='MAD', destination='LON')
1010
# print(response.data)
1111
except ResponseError as error:
12-
print(error)
1312
raise error

examples/flight_checkin_links/flight_checkin_links.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,5 +9,4 @@
99
response = amadeus.reference_data.urls.checkin_links.get(airlineCode='BA')
1010
# print(response.data)
1111
except ResponseError as error:
12-
print(error)
1312
raise error

examples/flight_choice_prediction/flight_choice_prediction.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,5 +11,4 @@
1111
response = amadeus.shopping.flight_offers.prediction.post(result)
1212
# print(response.data)
1313
except ResponseError as error:
14-
print(error)
1514
raise error

0 commit comments

Comments
 (0)