{ "info": { "author": "Alex Peters", "author_email": "", "bugtrack_url": null, "classifiers": [ "Development Status :: 5 - Production/Stable", "License :: OSI Approved :: MIT License", "Natural Language :: English", "Operating System :: OS Independent", "Programming Language :: Python :: 3.6", "Programming Language :: Python :: 3.7" ], "description": "################################################\n``metlinkpid-http``: HTTP server for Metlink PID\n################################################\n\n.. image:: https://img.shields.io/pypi/v/metlinkpid-http.svg\n :target: https://pypi.org/project/metlinkpid-http\n :alt: latest release on PyPI\n\nThe ``metlinkpid-http`` script\nprovides an HTTP endpoint for a Metlink LED passenger information display::\n\n $ metlinkpid-http --serial=/dev/ttyUSB0\n Serving on http://127.0.0.1:8080\n\n $ curl 'http://127.0.0.1:8080?12:34+FUNKYTOWN~5|Limited+Express|_Stops+all+stations+except+East+Richard'\n {\"error\":null,\"message\":\"12:34 FUNKYTOWN~5|Limited Express|_Stops all stations except East Richard\"}\n\n\nInstallation\n============\n\nInstall from PyPI_ using pip_::\n\n pip install metlinkpid-http\n\n.. _PyPI: https://pypi.org/project/metlinkpid-http\n.. _pip: https://pip.pypa.io/\n\n\nBasic usage\n===========\n\nFind the device\n---------------\n\nDetermine the device to which the display is connected.\nOn Linux, this can be achieved by disconnecting the display from the computer & reconnecting,\nthen inspecting the contents of ``dmesg`` output for USB attachment messages::\n\n [ 3.010816] usb 1-1.4: FTDI USB Serial Device converter now attached to ttyUSB0\n\nThe above output indicates that the display is reachable through ``/dev/ttyUSB0``.\n\nStart the HTTP server\n---------------------\n\nRun the script passing that device location as the ``--serial`` option::\n\n $ metlinkpid-http --serial=/dev/tty/USB0\n\nThe script accepts the following options:\n\n``--serial=PORT``\n The PID serial device name,\n such as ``/dev/ttyUSB0`` on Linux or ``COM1`` on Windows.\n If not specified, defaults to the value of environment variable ``METLINKPID_SERIAL``;\n if no such variable, defaults to ``/dev/ttyUSB0``.\n\n``--http=HOST:PORT``\n The hostname/IP address and port to listen on, separated by a colon (``:``).\n If not specified, defaults to the value of environment variable ``METLINKPID_HTTP``;\n if no such variable, defaults to ``127.0.0.1:8080``.\n\n``-h`` or ``--help``\n Displays usage information similar to above,\n and provides a link to this documentation.\n\nIf the PID successfully connects, the URL is confirmed::\n\n Serving on http://127.0.0.1:8080\n\n\nDisplay a message\n-----------------\n\nNext, browse to the specified URL in a browser,\nadding an `appropriately encoded query string`_ to the end:\n\n http://127.0.0.1:8080?MY+MESSAGE\n\nYou should see a plain-text JSON result similar to this::\n\n {\"error\":null,\"message\":\"MY MESSAGE\"}\n\nThe same result can be obtained on the terminal using ``curl``::\n\n $ curl 'http://127.0.0.1:8080?MY+MESSAGE'\n {\"error\":null,\"message\":\"MY MESSAGE\"}\n\nYou could do the same thing in Python like this, using the `\"requests\" library`_:\n\n>>> import requests\n>>> requests.get('http://127.0.0.1:8080?MY+MESSAGE').json()\n{'error': None, 'message': 'MY MESSAGE'}\n\nBy exposing the display via HTTP in this way,\nyou can operate it using almost any programming language or toolkit.\n\nSee the `\"metlinkpid\" module documentation`_\nfor full details about message formatting.\n\nThe HTTP server also periodically pings the display in the background,\npreventing message display timeout.\n\n.. _appropriately encoded query string:\n https://en.wikipedia.org/wiki/Percent-encoding#Percent-encoding_in_a_URI\n.. _\"requests\" library:\n https://2.python-requests.org\n.. _\"metlinkpid\" module documentation:\n https://python-metlinkpid.readthedocs.io\n\n\nSupport\n=======\n\nBug reports, feature requests, and questions are welcome via the issue tracker.\n\n:Issue tracker: https://github.com/Lx/python-metlinkpid-http/issues\n\n\nContribute\n==========\n\nPull requests for both code and documentation improvements\nare gratefully received and considered.\n\n:GitHub repository: https://github.com/Lx/python-metlinkpid-http\n\n\nLicense\n=======\n\nThis project is licensed under the `MIT License`_.\n\n.. _MIT License: https://opensource.org/licenses/MIT\n\n\n", "description_content_type": "", "docs_url": null, "download_url": "", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/Lx/python-metlinkpid-http", "keywords": "", "license": "", "maintainer": "", "maintainer_email": "", "name": "metlinkpid-http", "package_url": "https://pypi.org/project/metlinkpid-http/", "platform": "", "project_url": "https://pypi.org/project/metlinkpid-http/", "project_urls": { "Homepage": "https://github.com/Lx/python-metlinkpid-http" }, "release_url": "https://pypi.org/project/metlinkpid-http/1.0.0/", "requires_dist": [ "metlinkpid (~=1.0.1)", "flask (~=1.0.2)", "envopt (~=0.2.0)", "waitress (~=1.3.0)" ], "requires_python": "~=3.6", "summary": "HTTP server for Metlink PID", "version": "1.0.0" }, "last_serial": 5407032, "releases": { "1.0.0": [ { "comment_text": "", "digests": { "md5": "7eb2a85e1373277a915821989e7c5d1b", "sha256": "2fca750438a1be5f53ba438076018a4236a5b2f65c55429e2da52f8ecd68a3c9" }, "downloads": -1, "filename": "metlinkpid_http-1.0.0-py3-none-any.whl", "has_sig": false, "md5_digest": "7eb2a85e1373277a915821989e7c5d1b", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": "~=3.6", "size": 5000, "upload_time": "2019-06-16T17:14:33", "url": "https://files.pythonhosted.org/packages/55/58/090b420ee881d86d071ad1dda75d0d4aca71e324818c31aade403dd3f260/metlinkpid_http-1.0.0-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "14a429d28eaf4e0c7856b5743e4f0593", "sha256": "39f8b014a9002765f8abc4a2c9dd35ebe0fbae1406d0146ecc3eb5ddc3f7aa8f" }, "downloads": -1, "filename": "metlinkpid-http-1.0.0.tar.gz", "has_sig": false, "md5_digest": "14a429d28eaf4e0c7856b5743e4f0593", "packagetype": "sdist", "python_version": "source", "requires_python": "~=3.6", "size": 4599, "upload_time": "2019-06-16T17:14:35", "url": "https://files.pythonhosted.org/packages/72/64/eca15c95b68ec5dec45b89133d82efc9d3609f9266a0887ef344323e520e/metlinkpid-http-1.0.0.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "7eb2a85e1373277a915821989e7c5d1b", "sha256": "2fca750438a1be5f53ba438076018a4236a5b2f65c55429e2da52f8ecd68a3c9" }, "downloads": -1, "filename": "metlinkpid_http-1.0.0-py3-none-any.whl", "has_sig": false, "md5_digest": "7eb2a85e1373277a915821989e7c5d1b", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": "~=3.6", "size": 5000, "upload_time": "2019-06-16T17:14:33", "url": "https://files.pythonhosted.org/packages/55/58/090b420ee881d86d071ad1dda75d0d4aca71e324818c31aade403dd3f260/metlinkpid_http-1.0.0-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "14a429d28eaf4e0c7856b5743e4f0593", "sha256": "39f8b014a9002765f8abc4a2c9dd35ebe0fbae1406d0146ecc3eb5ddc3f7aa8f" }, "downloads": -1, "filename": "metlinkpid-http-1.0.0.tar.gz", "has_sig": false, "md5_digest": "14a429d28eaf4e0c7856b5743e4f0593", "packagetype": "sdist", "python_version": "source", "requires_python": "~=3.6", "size": 4599, "upload_time": "2019-06-16T17:14:35", "url": "https://files.pythonhosted.org/packages/72/64/eca15c95b68ec5dec45b89133d82efc9d3609f9266a0887ef344323e520e/metlinkpid-http-1.0.0.tar.gz" } ] }