Skip to content

Instantly share code, notes, and snippets.

@kchandan
Created January 7, 2018 19:05
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kchandan/964f62595ca3f633dd4487f0910b7de6 to your computer and use it in GitHub Desktop.
Save kchandan/964f62595ca3f633dd4487f0910b7de6 to your computer and use it in GitHub Desktop.
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