Created
January 7, 2018 19:05
-
-
Save kchandan/964f62595ca3f633dd4487f0910b7de6 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from flask import Flask | |
from flask import request | |
import json | |
app = Flask(__name__) | |
@app.route('/') | |
def hello(): | |
return "Check Code of countries" | |
#for searching country code run on address bar http://127.0.0.1:5000/country-name | |
@app.route('/api/v1/countries') | |
def iso_country(): | |
dict={'UK':'GB', 'India':'IND','Ireland':'IE','France':'FR','China':'CHN','Indonesia':'IDN','Spain':'ES'} | |
country_name = request.args.get('name') | |
return dict[country_name] | |
if __name__ == '__main__': | |
app.run() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment