PNR Status - Query via (Beta)

Welcome to the home of @inrpnr on the WWW. Here you can find information about how to use the twitter application @inrpnr to query the status of your Indian Railways booking

If you have a twitter account and want to query the status of your Indian Railways ticket booking, but don't want to spend additional money on SMSes to 139, well, here is your solution. By sending simple query messages to @inrpnr you can get back information about your ticket status in a convenient format - without any additional cost or irritating ads in your responses.

How do I query?

Using this service is really easy. Just following these simple steps:

  1. Follow @inrpnr

  2. @inrpnr will notice this and follow you right back

  3. You can now send a Direct Message to @inrpnr with a message like "1234567890 check" where the numeric thingy is your PNR and 'check' is the keyword. @inrpnr will notice this message, look up your PNR status and send you a DM back. It's that simple

Early adopters of @inrpnr service should note that the 'Mention Mode' of querying is now no longer available. This allows us to keep your responses private, keep the @inrpnr timeline clutter free for all followers, and allow us to send service updates using tweets from @inrpnr.

Query Reference

A comprehensive list of all commands you can issue is given below:

  1. help [train, passengers, no, name, date, from, to, upto, boarding, class, chart]

    Returns a help string with commands that can be issued. If one or more of the optional commands are present, a help string on the sepcified commands is returned.

  2. 1234567890 check

    This is the simplest query and gives back the most information:

    • Train Number
    • Train Name
    • Date of Journey
    • Station From (2 or 3 letter code)
    • Station To (2 or 3 letter code)
    • Station Reserv Upto (2 or 3 letter code
    • Boarding Point (2 or 3 letter code)
    • Class
    • Chart Status
    • For Each travelling pasenger:
      • Booking Status
      • Current Status

  3. 1234567890 check train

    Returns same as "check", but without passenger status

  4. 1234567890 check [no, name, date, from, to, upto, boarding, class, chart]

    i.e. the query is one of the commands in the [...] - returns only that field from the Train Status information. You can specify more than one command separated by space(s)

  5. 1234567890 check passengers

    Returns for each travelling passenger:

    • Booking Status
    • Current Status

  6. 1234567890 check p1

    i.e. p and digit one. Returns passenger status for passenger #1 in the ticket. p1 can be replaced with p2, p3 etc. An error will be returned if specified passenger is not in the ticket

    You can mix the passenger query commands with the train information query commands above

Notes:

  1. Commands are separated by whitespace. Unrecognized commands will be silently ignored. Note that help and check are keywords, and if a DM to @inrpnr has neither of those keywords then you will not get any response back.

  2. Twitter does not allow posting of duplicate messages. If you wish to repeatedly check the status of the same PNR just append a '1' '2' etc. to your queries. These tokens will be ignored by @inrpnr as unrecognized commands.

    The problem of duplicates is there for responses from @inrpnr too. We work around this by appending a string such as (igxyz) where xyz is a random integer betwee 0-999 to every message we send.

  3. If any result exceeds 140 characters it should automatically be split into multiple messages and sent back in Mention Mode or DM Mode as appropriate.

  4. Any @inrpnr mention not containing the 'check' keyword is not treated as a query and ignored by the app.

About

About @inrpnr

@inrpnr is a twitter application hosted on Google App Engine (GAE). As GAE does not allow hanging GETs, @inrpnr is built using the polling based Twitter REST API, and not the far cooler Twitter Streaming API. As a direct result of this responses to queries can take upto 1 minute in the worst case.

About the Author

I am Sriram Karra (@skarra), a part-time programmer and part-time "suit" living in Bangalore. I wrote this application to get a hands-on feel for "new age" programming tools and frameworks such as Web APIs and Cloud frameworks, and learn some Python along the way.

Credits

The application is built on code and ideas from the following sources:

  • Tweepy for the twitter oauth and REST API implementation in python
  • Mechanize for fetching web content easily
  • gaemechanize2 for ideas on how to port mechanize to GAE (the original linked here is is based on mechanize-0.1.11 and not kept current with recent versions of mechanize. So I ported it manually to mechanize-0.2.4)
  • BeautifulSoup a python HTML parser to wade through the html tables from Indian Railway's website
  • National Gallery of Art for CSS And HTML inspiration for this site