Last active
February 15, 2019 12:28
-
-
Save Adarshreddyash/befd988979d1aa09853c7c7ec03033f0 to your computer and use it in GitHub Desktop.
This file contains 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
app=Flask(__name__) | |
@app.route('/') | |
def ash(req): | |
mandi=requests.get('https://api.data.gov.in/resource/9ef84268-d588-465a-a308-a864a43d0070?api-key=YOUR_API_KEY&format=json&offset=0&limit=1') | |
mandi=json.loads(mandi) | |
for item in mandi['records']: | |
response = """ | |
state: {0} | |
district: {1} | |
market: {2} | |
crop: {3} | |
variety: {4} | |
arrival date: {5} | |
min price: {6} | |
max price: {7} | |
modal price: {8} | |
""".format(item['state'],item['district'], item['market'] ,item['commodity'] ,item['variety'], item['arrival_date'] ,item['min_pric | |
return jsonify({'This is the output:':response}) | |
if __name__ =='__main__': | |
port = int(os.getenv('PORT',5000)) | |
print("starting gspace server on port %d" % port) | |
app.run(debug=True, port=port, host='0.0.0.0') |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment