Skip to content

Commit 1e80ba6

Browse files
inklesspenJon Wayne Parrott
authored and
Jon Wayne Parrott
committed
Add a new sample service for Endpoints Frameworks for Python (GoogleCloudPlatform#1325)
The IATA sample service provides examples of CRUD operations, managing a list of airports and their corresponding IATA codes. This service will be used in documentation for the Endpoints Frameworks.
1 parent 5647df0 commit 1e80ba6

File tree

6 files changed

+412
-0
lines changed

6 files changed

+412
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
## Endpoints Frameworks v2 Python Sample (Airport Information Edition)
2+
3+
[![Open in Cloud Shell][shell_img]][shell_link]
4+
5+
[shell_img]: http://gstatic.com/cloudssh/images/open-btn.png
6+
[shell_link]: https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/GoogleCloudPlatform/python-docs-samples&page=editor&open_in_editor=appengine/standard/endpoints-frameworks-v2/echo/README.md
7+
8+
This demonstrates how to use Google Cloud Endpoints Frameworks v2 on Google App Engine Standard Environment using Python.
9+
10+
## Setup
11+
12+
Create a `lib` directory in which to install the Endpoints Frameworks v2 library. For more info, see [Installing a library](https://cloud.google.com/appengine/docs/python/tools/using-libraries-python-27#installing_a_library).
13+
14+
Install the Endpoints Frameworks v2 library:
15+
16+
$ pip install -t lib -r requirements.txt
17+
18+
## Deploying to Google App Engine
19+
20+
Generate an OpenAPI file by running: `python lib/endpoints/endpointscfg.py get_openapi_spec main.IataApi --hostname [YOUR-PROJECT-ID].appspot.com`
21+
22+
Remember to replace [YOUR-PROJECT-ID] with your project ID.
23+
24+
Deploy the generated service spec to Google Cloud Service Management: `gcloud endpoints services deploy iatav1openapi.json`
25+
26+
The command returns several lines of information, including a line similar to the following:
27+
28+
Service Configuration [2016-08-01r0] uploaded for service "[YOUR-PROJECT-ID].appspot.com"
29+
30+
Open the `app.yaml` file and in the `env_variables` section, replace [YOUR-PROJECT-ID] in `[YOUR-PROJECT-ID].appspot.com` with your project ID. This is your Endpoints service name. Then replace `2016-08-01r0` with your uploaded service management configuration.
31+
32+
Then, deploy the sample using `gcloud`:
33+
34+
$ gcloud app deploy
35+
36+
Once deployed, you can access the application at https://your-service.appspot.com
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
runtime: python27
2+
threadsafe: true
3+
api_version: 1
4+
basic_scaling:
5+
max_instances: 2
6+
7+
skip_files:
8+
- ^(.*/)?#.*#$
9+
- ^(.*/)?.*~$
10+
- ^(.*/)?.*\.py[co]$
11+
- ^(.*/)?.*/RCS/.*$
12+
- ^(.*/)?\..*$
13+
- ^(.*/)?setuptools/script \(dev\).tmpl$
14+
15+
handlers:
16+
# The endpoints handler must be mapped to /_ah/api.
17+
- url: /_ah/api/.*
18+
script: main.api
19+
20+
libraries:
21+
- name: pycrypto
22+
version: 2.6
23+
- name: ssl
24+
version: 2.7.11
25+
26+
env_variables:
27+
# The following values are to be replaced by information from the output of
28+
# 'gcloud endpoints services deploy swagger.json' command.
29+
ENDPOINTS_SERVICE_NAME: YOUR-PROJECT-ID.appspot.com
30+
ENDPOINTS_SERVICE_VERSION: 2016-08-01r0
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
# Copyright 2018 Google Inc. All rights reserved.
2+
#
3+
# Licensed under the Apache License, Version 2.0 (the "License");
4+
# you may not use this file except in compliance with the License.
5+
# You may obtain a copy of the License at
6+
#
7+
# http://www.apache.org/licenses/LICENSE-2.0
8+
#
9+
# Unless required by applicable law or agreed to in writing, software
10+
# distributed under the License is distributed on an "AS IS" BASIS,
11+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
# See the License for the specific language governing permissions and
13+
# limitations under the License.
14+
15+
from google.appengine.ext import vendor
16+
17+
# Add any libraries installed in the `lib` folder.
18+
vendor.add('lib')
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,207 @@
1+
# Copyright 2018 Google Inc. All rights reserved.
2+
#
3+
# Licensed under the Apache License, Version 2.0 (the "License");
4+
# you may not use this file except in compliance with the License.
5+
# You may obtain a copy of the License at
6+
#
7+
# http://www.apache.org/licenses/LICENSE-2.0
8+
#
9+
# Unless required by applicable law or agreed to in writing, software
10+
# distributed under the License is distributed on an "AS IS" BASIS,
11+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
# See the License for the specific language governing permissions and
13+
# limitations under the License.
14+
15+
AIRPORTS = {
16+
u'ABQ': u'Albuquerque International Sunport Airport',
17+
u'ACA': u'General Juan N Alvarez International Airport',
18+
u'ADW': u'Andrews Air Force Base',
19+
u'AFW': u'Fort Worth Alliance Airport',
20+
u'AGS': u'Augusta Regional At Bush Field',
21+
u'AMA': u'Rick Husband Amarillo International Airport',
22+
u'ANC': u'Ted Stevens Anchorage International Airport',
23+
u'ATL': u'Hartsfield Jackson Atlanta International Airport',
24+
u'AUS': u'Austin Bergstrom International Airport',
25+
u'AVL': u'Asheville Regional Airport',
26+
u'BAB': u'Beale Air Force Base',
27+
u'BAD': u'Barksdale Air Force Base',
28+
u'BDL': u'Bradley International Airport',
29+
u'BFI': u'Boeing Field King County International Airport',
30+
u'BGR': u'Bangor International Airport',
31+
u'BHM': u'Birmingham-Shuttlesworth International Airport',
32+
u'BIL': u'Billings Logan International Airport',
33+
u'BLV': u'Scott AFB/Midamerica Airport',
34+
u'BMI': u'Central Illinois Regional Airport at Bloomington-Normal',
35+
u'BNA': u'Nashville International Airport',
36+
u'BOI': u'Boise Air Terminal/Gowen field',
37+
u'BOS': u'General Edward Lawrence Logan International Airport',
38+
u'BTR': u'Baton Rouge Metropolitan, Ryan Field',
39+
u'BUF': u'Buffalo Niagara International Airport',
40+
u'BWI': u'Baltimore/Washington International Thurgood Marshall Airport',
41+
u'CAE': u'Columbia Metropolitan Airport',
42+
u'CBM': u'Columbus Air Force Base',
43+
u'CHA': u'Lovell Field',
44+
u'CHS': u'Charleston Air Force Base-International Airport',
45+
u'CID': u'The Eastern Iowa Airport',
46+
u'CLE': u'Cleveland Hopkins International Airport',
47+
u'CLT': u'Charlotte Douglas International Airport',
48+
u'CMH': u'Port Columbus International Airport',
49+
u'COS': u'City of Colorado Springs Municipal Airport',
50+
u'CPR': u'Casper-Natrona County International Airport',
51+
u'CRP': u'Corpus Christi International Airport',
52+
u'CRW': u'Yeager Airport',
53+
u'CUN': u'Canc\xfan International Airport',
54+
u'CVG': u'Cincinnati Northern Kentucky International Airport',
55+
u'CVS': u'Cannon Air Force Base',
56+
u'DAB': u'Daytona Beach International Airport',
57+
u'DAL': u'Dallas Love Field',
58+
u'DAY': u'James M Cox Dayton International Airport',
59+
u'DBQ': u'Dubuque Regional Airport',
60+
u'DCA': u'Ronald Reagan Washington National Airport',
61+
u'DEN': u'Denver International Airport',
62+
u'DFW': u'Dallas Fort Worth International Airport',
63+
u'DLF': u'Laughlin Air Force Base',
64+
u'DLH': u'Duluth International Airport',
65+
u'DOV': u'Dover Air Force Base',
66+
u'DSM': u'Des Moines International Airport',
67+
u'DTW': u'Detroit Metropolitan Wayne County Airport',
68+
u'DYS': u'Dyess Air Force Base',
69+
u'EDW': u'Edwards Air Force Base',
70+
u'END': u'Vance Air Force Base',
71+
u'ERI': u'Erie International Tom Ridge Field',
72+
u'EWR': u'Newark Liberty International Airport',
73+
u'FAI': u'Fairbanks International Airport',
74+
u'FFO': u'Wright-Patterson Air Force Base',
75+
u'FLL': u'Fort Lauderdale Hollywood International Airport',
76+
u'FSM': u'Fort Smith Regional Airport',
77+
u'FTW': u'Fort Worth Meacham International Airport',
78+
u'FWA': u'Fort Wayne International Airport',
79+
u'GDL': u'Don Miguel Hidalgo Y Costilla International Airport',
80+
u'GEG': u'Spokane International Airport',
81+
u'GPT': u'Gulfport Biloxi International Airport',
82+
u'GRB': u'Austin Straubel International Airport',
83+
u'GSB': u'Seymour Johnson Air Force Base',
84+
u'GSO': u'Piedmont Triad International Airport',
85+
u'GSP': u'Greenville Spartanburg International Airport',
86+
u'GUS': u'Grissom Air Reserve Base',
87+
u'HIB': u'Range Regional Airport',
88+
u'HMN': u'Holloman Air Force Base',
89+
u'HMO': u'General Ignacio P. Garcia International Airport',
90+
u'HNL': u'Honolulu International Airport',
91+
u'HOU': u'William P Hobby Airport',
92+
u'HSV': u'Huntsville International Carl T Jones Field',
93+
u'HTS': u'Tri-State/Milton J. Ferguson Field',
94+
u'IAD': u'Washington Dulles International Airport',
95+
u'IAH': u'George Bush Intercontinental Houston Airport',
96+
u'ICT': u'Wichita Mid Continent Airport',
97+
u'IND': u'Indianapolis International Airport',
98+
u'JAN': u'Jackson-Medgar Wiley Evers International Airport',
99+
u'JAX': u'Jacksonville International Airport',
100+
u'JFK': u'John F Kennedy International Airport',
101+
u'JLN': u'Joplin Regional Airport',
102+
u'LAS': u'McCarran International Airport',
103+
u'LAX': u'Los Angeles International Airport',
104+
u'LBB': u'Lubbock Preston Smith International Airport',
105+
u'LCK': u'Rickenbacker International Airport',
106+
u'LEX': u'Blue Grass Airport',
107+
u'LFI': u'Langley Air Force Base',
108+
u'LFT': u'Lafayette Regional Airport',
109+
u'LGA': u'La Guardia Airport',
110+
u'LIT': u'Bill & Hillary Clinton National Airport/Adams Field',
111+
u'LTS': u'Altus Air Force Base',
112+
u'LUF': u'Luke Air Force Base',
113+
u'MBS': u'MBS International Airport',
114+
u'MCF': u'Mac Dill Air Force Base',
115+
u'MCI': u'Kansas City International Airport',
116+
u'MCO': u'Orlando International Airport',
117+
u'MDW': u'Chicago Midway International Airport',
118+
u'MEM': u'Memphis International Airport',
119+
u'MEX': u'Licenciado Benito Juarez International Airport',
120+
u'MGE': u'Dobbins Air Reserve Base',
121+
u'MGM': u'Montgomery Regional (Dannelly Field) Airport',
122+
u'MHT': u'Manchester Airport',
123+
u'MIA': u'Miami International Airport',
124+
u'MKE': u'General Mitchell International Airport',
125+
u'MLI': u'Quad City International Airport',
126+
u'MLU': u'Monroe Regional Airport',
127+
u'MOB': u'Mobile Regional Airport',
128+
u'MSN': u'Dane County Regional Truax Field',
129+
u'MSP': u'Minneapolis-St Paul International/Wold-Chamberlain Airport',
130+
u'MSY': u'Louis Armstrong New Orleans International Airport',
131+
u'MTY': u'General Mariano Escobedo International Airport',
132+
u'MUO': u'Mountain Home Air Force Base',
133+
u'OAK': u'Metropolitan Oakland International Airport',
134+
u'OKC': u'Will Rogers World Airport',
135+
u'ONT': u'Ontario International Airport',
136+
u'ORD': u"Chicago O'Hare International Airport",
137+
u'ORF': u'Norfolk International Airport',
138+
u'PAM': u'Tyndall Air Force Base',
139+
u'PBI': u'Palm Beach International Airport',
140+
u'PDX': u'Portland International Airport',
141+
u'PHF': u'Newport News Williamsburg International Airport',
142+
u'PHL': u'Philadelphia International Airport',
143+
u'PHX': u'Phoenix Sky Harbor International Airport',
144+
u'PIA': u'General Wayne A. Downing Peoria International Airport',
145+
u'PIT': u'Pittsburgh International Airport',
146+
u'PPE': u'Mar de Cort\xe9s International Airport',
147+
u'PVR': u'Licenciado Gustavo D\xedaz Ordaz International Airport',
148+
u'PWM': u'Portland International Jetport Airport',
149+
u'RDU': u'Raleigh Durham International Airport',
150+
u'RFD': u'Chicago Rockford International Airport',
151+
u'RIC': u'Richmond International Airport',
152+
u'RND': u'Randolph Air Force Base',
153+
u'RNO': u'Reno Tahoe International Airport',
154+
u'ROA': u'Roanoke\u2013Blacksburg Regional Airport',
155+
u'ROC': u'Greater Rochester International Airport',
156+
u'RST': u'Rochester International Airport',
157+
u'RSW': u'Southwest Florida International Airport',
158+
u'SAN': u'San Diego International Airport',
159+
u'SAT': u'San Antonio International Airport',
160+
u'SAV': u'Savannah Hilton Head International Airport',
161+
u'SBN': u'South Bend Regional Airport',
162+
u'SDF': u'Louisville International Standiford Field',
163+
u'SEA': u'Seattle Tacoma International Airport',
164+
u'SFB': u'Orlando Sanford International Airport',
165+
u'SFO': u'San Francisco International Airport',
166+
u'SGF': u'Springfield Branson National Airport',
167+
u'SHV': u'Shreveport Regional Airport',
168+
u'SJC': u'Norman Y. Mineta San Jose International Airport',
169+
u'SJD': u'Los Cabos International Airport',
170+
u'SKA': u'Fairchild Air Force Base',
171+
u'SLC': u'Salt Lake City International Airport',
172+
u'SMF': u'Sacramento International Airport',
173+
u'SNA': u'John Wayne Airport-Orange County Airport',
174+
u'SPI': u'Abraham Lincoln Capital Airport',
175+
u'SPS': u'Sheppard Air Force Base-Wichita Falls Municipal Airport',
176+
u'SRQ': u'Sarasota Bradenton International Airport',
177+
u'SSC': u'Shaw Air Force Base',
178+
u'STL': u'Lambert St Louis International Airport',
179+
u'SUS': u'Spirit of St Louis Airport',
180+
u'SUU': u'Travis Air Force Base',
181+
u'SUX': u'Sioux Gateway Col. Bud Day Field',
182+
u'SYR': u'Syracuse Hancock International Airport',
183+
u'SZL': u'Whiteman Air Force Base',
184+
u'TCM': u'McChord Air Force Base',
185+
u'TIJ': u'General Abelardo L. Rodr\xedguez International Airport',
186+
u'TIK': u'Tinker Air Force Base',
187+
u'TLH': u'Tallahassee Regional Airport',
188+
u'TOL': u'Toledo Express Airport',
189+
u'TPA': u'Tampa International Airport',
190+
u'TRI': u'Tri Cities Regional Tn Va Airport',
191+
u'TUL': u'Tulsa International Airport',
192+
u'TUS': u'Tucson International Airport',
193+
u'TYS': u'McGhee Tyson Airport',
194+
u'VBG': u'Vandenberg Air Force Base',
195+
u'VPS': u'Destin-Ft Walton Beach Airport',
196+
u'WRB': u'Robins Air Force Base',
197+
u'YEG': u'Edmonton International Airport',
198+
u'YHZ': u'Halifax / Stanfield International Airport',
199+
u'YOW': u'Ottawa Macdonald-Cartier International Airport',
200+
u'YUL': u'Montreal / Pierre Elliott Trudeau International Airport',
201+
u'YVR': u'Vancouver International Airport',
202+
u'YWG': u'Winnipeg / James Armstrong Richardson International Airport',
203+
u'YYC': u'Calgary International Airport',
204+
u'YYJ': u'Victoria International Airport',
205+
u'YYT': u"St. John's International Airport",
206+
u'YYZ': u'Lester B. Pearson International Airport'
207+
}

0 commit comments

Comments
 (0)