Skip to content

Instantly share code, notes, and snippets.

@amjd
Created September 15, 2014 17:38
Show Gist options
  • Save amjd/ce4a1b2d7931dcd517f5 to your computer and use it in GitHub Desktop.
Save amjd/ce4a1b2d7931dcd517f5 to your computer and use it in GitHub Desktop.
import requests as r
import json
pnr = "6533533388"
url = "https://indianrailways.p.mashape.com/index.php?pnr="
headers = {'X-Mashape-Authorization': 'MASHAPE_API_KEY'}
data = r.get('%s%s' % (url,pnr),headers=headers)
data_json = json.loads(data.text)
print "YPR to NGP:", data_json['bookingStatus'][0]['currentStatus']
#You can get your API key at https://www.mashape.com/blaazetech/indian-railways
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment