{ "info": { "author": "Eric Stein", "author_email": "toba@des.truct.org", "bugtrack_url": null, "classifiers": [], "description": "\n# Chicago (ORD)ata\n\nThis library is for accessing Chicago related data via Python. I'd prefer to focus on web APIs but I'm gonna go where the data is.\n\n\n## CTA Traintracker\n\nTo start, I'm implementing Train Tracker API. Below is a cursory usage example.\n\n\n### To start up, just instantiate an instance of the Train class to initialize the connection to the API.\n\n >>> import ordat.cta as cta\n >>> train = cta.Train(key='YOURKEYHERE')\n\n\n### Get Arrivals by mapid\n\n >>> train.arrivals(mapid=40380)\n [Blue Line/Clark/Lake run 139 to O'Hare at 03:00:00, Blue Line/Clark/Lake run 225 to Forest Park at 03:06:52]\n\n\n### Advanced Mode: Find All Scheduled/Active Runs\n\n >>> # get arrivals for every station in the system\n >>> all_arrivals = reduce(lambda a1,a2: a1+a2, [station.arrivals() for station in cta.Station.all])\n >>> # get the run numbers of every active train in the system at the current time\n >>> run_nums = set([arrival.run_number for arrival in all_arrivals])\n >>> len(run_nums)\n 16\n\nThis was run late at night, so it found far less than normal!\n\n\n### Find Current Train Locations\n\n import ordat.cta as cta\n train = cta.Train(key='YOURKEYHERE')\n tr = cta.panopticon.Tracker()\n for rn,lat,lon in tr.step() :\n print rn, lat, lon\n\nThis can take a bit to pick up the locations, so run the last two lines a couple times and wait in between.\n\n\n### Station Search, Station Arrivals, Stop Arrivals\n\n >>> # Find a station, and then check its arrivals\n >>> cta.Station.find('Clark/Lake')[0].arrivals()\n [Blue Line/Clark/Lake run 139 to O'Hare at 03:00:00, Blue Line/Clark/Lake run 225 to Forest Park at 03:05:53]\n >>> # Check what lines a station services\n >>> cta.Station.find('Clark/Lake')[0].lines\n [Pink Line, Blue Line, Purple Express Line, Orange Line, Brown Line, Green Line]\n >>> cl_stops = cta.Station.find('Clark/Lake')[0].stops\n >>> cl_stops\n [E-bound Stop Clark/Lake (Inner Loop) at Station Clark/Lake, W-bound Stop Clark/Lake (Outer Loop) at Station Clark/Lake, S-bound Stop Clark/Lake (Forest Pk-bound) at Station Clark/Lake, N-bound Stop Clark/Lake (O'Hare-bound) at Station Clark/Lake]\n >>> cl_stops[-1].arrivals()\n [Blue Line/Clark/Lake run 139 to O'Hare at 03:00:00]\n\nI intend to make the data more well formed and parsed, validated etc later. It implements a thin little caching layer to conserve API usage for requests for the same information placed in quick succession.\n\nThis is a quick wrapper around http://www.transitchicago.com/assets/1/developer_center/cta_Train_Tracker_API_documentation_v1_2.pdf\n\nTo add:\n\n* Finding closest stations by lat/long, line, name, etc\n* inbuilt code for acquiring data about stop-to-stop transit timings\n* ability to understand delays, scheduled stops, faults in the system\n* Unit testing for all of above\n* Relate responses and requests on the arrivals API to my object hierarchy\n* Color codes on lines\n* Directionality of lines\n* Determine 'next' stops for each stop (platform)\n\n\n# Dependencies\n\n* git://github.com/martinblech/xmltodict.git\n* Everything in requirements.txt\n\n\n# Tests\n\n PYTHONPATH=../xmltodict:~/pyenvs/cta/lib/python2.7/site-packages/ nosetests -vv tests\n\nThe above is just an example, I'm not sure why virtualenv isn't picking up the requests module just by sourcing activate.", "description_content_type": null, "docs_url": null, "download_url": "UNKNOWN", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "http://github.com/eastein/ordat", "keywords": null, "license": "LICENSE", "maintainer": null, "maintainer_email": null, "name": "ordat", "package_url": "https://pypi.org/project/ordat/", "platform": "UNKNOWN", "project_url": "https://pypi.org/project/ordat/", "project_urls": { "Download": "UNKNOWN", "Homepage": "http://github.com/eastein/ordat" }, "release_url": "https://pypi.org/project/ordat/0.1.0/", "requires_dist": null, "requires_python": null, "summary": "Wrapper for the Chicago CTA XML API.", "version": "0.1.0" }, "last_serial": 1812473, "releases": { "0.1.0": [ { "comment_text": "", "digests": { "md5": "7c4317817a9a51b9e280a1ec53436307", "sha256": "bea9bbe0d2523b3ae01e62fa500f7da0acb699047146b08ef0a96590d4f20424" }, "downloads": -1, "filename": "ordat-0.1.0.tar.gz", "has_sig": false, "md5_digest": "7c4317817a9a51b9e280a1ec53436307", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 13516, "upload_time": "2015-11-12T02:32:59", "url": "https://files.pythonhosted.org/packages/d2/6b/21477a3fe153a360cc3cc2af560767ec4e139f70ef4d7e5ebfd2a59a51a6/ordat-0.1.0.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "7c4317817a9a51b9e280a1ec53436307", "sha256": "bea9bbe0d2523b3ae01e62fa500f7da0acb699047146b08ef0a96590d4f20424" }, "downloads": -1, "filename": "ordat-0.1.0.tar.gz", "has_sig": false, "md5_digest": "7c4317817a9a51b9e280a1ec53436307", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 13516, "upload_time": "2015-11-12T02:32:59", "url": "https://files.pythonhosted.org/packages/d2/6b/21477a3fe153a360cc3cc2af560767ec4e139f70ef4d7e5ebfd2a59a51a6/ordat-0.1.0.tar.gz" } ] }