{ "info": { "author": "Tom Smith", "author_email": "tom@takeontom.com", "bugtrack_url": null, "classifiers": [ "Development Status :: 2 - Pre-Alpha", "Intended Audience :: Developers", "License :: OSI Approved :: MIT License", "Natural Language :: English", "Programming Language :: Python :: 3.5", "Programming Language :: Python :: 3.6" ], "description": "camgrab\n=======\n\nPython library to download images from network accessible webcams.\n\nFeatures\n--------\n\n* Out of the box, handles any webcam which provides a publically accessible URL\n to a JPG snapshot of their current image.\n* Easily swap in different downloaders to handle cams which expose their\n snapshots in a more complex way.\n* Highly configurable.\n* Provides a simple base for more advanced functionality, such as motion\n detection, CCTV systems, image analysis, etc.\n\nInstallation\n------------\n\n.. code:: sh\n\n pip install camgrab\n\n\nQuick start\n-----------\n\nTo simply grabbing images from a webcam every 2 seconds and start saving them\nto the default `grabbed_images` directory:\n\n.. code:: python\n\n from camgrab import Grabber\n\n grabber = Grabber('http://www.masconcable.ca/webcams/chase.jpg')\n grabber.begin()\n\nExamples\n--------\n\nQuickly add a custom result handler\n...................................\n\nHere we create a custom result handler which will simply print the\ndimensions of the grabbed image.\n\nThe default result handlers (e.g. `do_save_image()`) will still be used.\n\n.. code:: python\n\n from camgrab import Grabber\n\n url = 'http://www.masconcable.ca/webcams/chase.jpg'\n\n\n def print_dimensions(result, grabber):\n if not result.get('image', None):\n return\n\n width, height = result['image'].size\n print(\n '{width} pixels wide, {height} pixels high!'.\n format(width=width, height=height)\n )\n\n\n grabber = Grabber(url, every=5, extra_result_handlers=(print_dimensions, ))\n grabber.begin()\n\nMore complex result handling\n............................\n\nIn this example, we'll take full control of the result handling, creating a\nchain of result handlers to:\n\n* resize the image to 320x200\n* rotate the image by 90 degrees\n* save the image\n* print the final result dictionary to the terminal\n\n.. code:: python\n\n from camgrab import Grabber\n from camgrab.camgrab import do_save_image\n\n url = 'http://www.masconcable.ca/webcams/chase.jpg'\n\n\n def resize_image(result, grabber):\n if not result.get('image', None):\n return\n\n result['image'] = result['image'].resize((320, 200))\n\n\n def rotate_image(result, grabber):\n if not result.get('image', None):\n return\n\n result['image'] = result['image'].rotate(90)\n\n\n def print_result(result, grabber):\n print(result)\n\n\n # Setting result_handlers attribute completely overrides any default result\n # handlers previously set. Hence making sure `do_save_image` (which is normally\n # a default handler) is in this tuple:\n result_handlers = (resize_image, rotate_image, do_save_image, print_result)\n\n grabber = Grabber(url, every=5)\n grabber.result_handlers = result_handlers\n grabber.begin()\n\nTake control of the main loop\n.............................\n\nIf the the main loop created by the `begin()` method is too simple for your\nneeds, then either override the `begin()` method or simply call `tick()` from\nyour own consumer.\n\nIn this example, we consume a Grabber but define our own (not terribly useful)\nmain loop which waits a random amount of time between ticks:\n\n.. code:: python\n\n from random import random\n from time import sleep\n\n from camgrab import Grabber\n\n url = 'http://www.masconcable.ca/webcams/chase.jpg'\n grabber = Grabber(url)\n\n while True:\n grabber.tick()\n\n # Wait somewhere between 0 and 10 seconds\n sleep(random() * 10)\n\nError handling\n--------------\n\nGrabbing images from webcams is a messy business... They go offline loads, send\ncorrupted images, sometimes they randomly start sending Server 500 errors, etc.\n\nBecause of all this, camgrab's default settings make it pretty tolerant of\ncommon errors which occur when grabbing an image. But this can be configured\neasily enough.\n\nWhen an unhandled exception is raised during a ``tick()`` which causes a crash,\nthe exception which caused the crash can be found in the ``failed_exception``\nattribute.\n\nHTTP errors\n...........\n\nHTTP errors can be ignored or raised by setting `ignore_xxx` attributes. For\nexample...\n\nBy default HTTP 404 errors are not ignored by default. So when a 404 error\noccurs the grabber will crash and you can handle the exception in whatever way\nyou want.\n\n.. code:: python\n\n from urllib.error import HTTPError\n\n from camgrab import Grabber\n\n grabber = Grabber('http://www.masconcable.ca/webcams/chase.jpg')\n\n try:\n grabber.begin()\n except HTTPError as e:\n if e.code == 404:\n print('Was it something I said?')\n\nIf you'd rather HTTP 404 errors didn't cause a crash, then set the `ignore_404`\nattribute:\n\n.. code:: python\n\n from camgrab import Grabber\n\n grabber = Grabber('http://www.masconcable.ca/webcams/chase.jpg')\n grabber.ignore_404 = True\n\n grabber.begin()\n\nNow when a 404 error occurs, the Grabber will:\n\n* add the exception to the result dictionary\n* set the image in the result dictionary to `None`\n\nAnd then continue its normal routine.\n\nBy default, the following HTTP status codes are ignored:\n\n* 307, 400, 408, 409, 429, 444, 451, 499, 500, 502, 503, 504, 507, 599\n\nNetwork errors\n..............\n\ncamgrab ignores network errors by default. If you'd rather network timeouts\ncaused a crash, then just set the `ignore_timeout` attribute:\n\n.. code:: python\n\n from socket import timeout\n from urllib.error import URLError\n\n from camgrab import Grabber\n\n grabber = Grabber('http://www.masconcable.ca/webcams/chase.jpg')\n grabber.ignore_timeout = False\n\n try:\n grabber.begin()\n except URLError as e:\n if isinstance(e.reason, timeout):\n print(\"It's me, not you\")\n\n\nLicense\n-------\n\ncamgrab is free software, distributed under the MIT license.\n\n\n", "description_content_type": null, "docs_url": null, "download_url": "", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/takeontom/camgrab", "keywords": "", "license": "MIT license", "maintainer": "", "maintainer_email": "", "name": "camgrab", "package_url": "https://pypi.org/project/camgrab/", "platform": "", "project_url": "https://pypi.org/project/camgrab/", "project_urls": { "Homepage": "https://github.com/takeontom/camgrab" }, "release_url": "https://pypi.org/project/camgrab/0.9.1/", "requires_dist": [ "pillow (>=4)" ], "requires_python": "", "summary": "Python library for grabbing images from webcams", "version": "0.9.1" }, "last_serial": 3191655, "releases": { "0.8.1": [ { "comment_text": "", "digests": { "md5": "e29cc06e54e95e46ebd2d3cbccedd4a5", "sha256": "d18ba16bcfa0e0ff639f4acee512c639bdf2b2a09e3cc3b71476721f1624e919" }, "downloads": -1, "filename": "camgrab-0.8.1-py3-none-any.whl", "has_sig": false, "md5_digest": "e29cc06e54e95e46ebd2d3cbccedd4a5", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 7728, "upload_time": "2017-09-13T10:07:45", "url": "https://files.pythonhosted.org/packages/7f/69/eae709e7462a579804c6968bf41ef8e40313de22c068c7bd3feaf78c4f26/camgrab-0.8.1-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "2677aa1ab0fca2da027dd9369c89788e", "sha256": "dc5cd35e27ae6bfa4c3477e73ce895b30d7636bce485be566fbe05f15b197404" }, "downloads": -1, "filename": "camgrab-0.8.1.tar.gz", "has_sig": false, "md5_digest": "2677aa1ab0fca2da027dd9369c89788e", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 200819, "upload_time": "2017-09-13T10:07:47", "url": "https://files.pythonhosted.org/packages/1a/18/452c4f99378e88a5109477a7a571e7e2123690e5f645e9e20bbb9752ce86/camgrab-0.8.1.tar.gz" } ], "0.8.2": [ { "comment_text": "", "digests": { "md5": "d90779c6d2790bbd9b279cb47ec7179f", "sha256": "05f7f00498d3f92ccfe88e0a2789d5101adf6158c08c678c140f1d8283ef664d" }, "downloads": -1, "filename": "camgrab-0.8.2-py3-none-any.whl", "has_sig": false, "md5_digest": "d90779c6d2790bbd9b279cb47ec7179f", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 7732, "upload_time": "2017-09-13T10:17:11", "url": "https://files.pythonhosted.org/packages/19/0a/c4220a102cf958bf7864979efaae751d7b693e7617a2ecba23ab83c5f263/camgrab-0.8.2-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "01b8ed27182e727b4bb9842f73456b7d", "sha256": "f4064513aa130997addb5cb6b4925d91f237a1df07f051e09a4a8eeaf7a8c3c0" }, "downloads": -1, "filename": "camgrab-0.8.2.tar.gz", "has_sig": false, "md5_digest": "01b8ed27182e727b4bb9842f73456b7d", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 200830, "upload_time": "2017-09-13T10:17:13", "url": "https://files.pythonhosted.org/packages/29/c2/414a703b5de2846ab64b02ad5fb5a5f841650576b2486db290e802f602e5/camgrab-0.8.2.tar.gz" } ], "0.9.0": [ { "comment_text": "", "digests": { "md5": "c42adaa71a42f9c87da3d7b636dc28f8", "sha256": "17232f720e845ee8a42c17a983c8b3f0c882391ac78d73fe06dac4350f807a3a" }, "downloads": -1, "filename": "camgrab-0.9.0-py3-none-any.whl", "has_sig": false, "md5_digest": "c42adaa71a42f9c87da3d7b636dc28f8", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 11353, "upload_time": "2017-09-18T09:54:49", "url": "https://files.pythonhosted.org/packages/48/a5/4a0f85890246c3c6a372472d12655ffbb2891daa4b6a13073b537094d929/camgrab-0.9.0-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "c788418744ae703313b5efc4bfb58bd2", "sha256": "929e13b1619f1a524198ceabc840f812ab5e69a30820a07f4979554fe73a7c10" }, "downloads": -1, "filename": "camgrab-0.9.0.tar.gz", "has_sig": false, "md5_digest": "c788418744ae703313b5efc4bfb58bd2", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 206018, "upload_time": "2017-09-18T09:54:51", "url": "https://files.pythonhosted.org/packages/e0/8f/ee962e5aefa6631904cb4a7cd249300cde48025de69f70a79298b304228d/camgrab-0.9.0.tar.gz" } ], "0.9.1": [ { "comment_text": "", "digests": { "md5": "3f0d33bffa3ac4d8d082dad35bcb659d", "sha256": "972d3312e37ae06d16814e598506e97b6d6bf8370671b121b6ea68172f289b9b" }, "downloads": -1, "filename": "camgrab-0.9.1-py3-none-any.whl", "has_sig": false, "md5_digest": "3f0d33bffa3ac4d8d082dad35bcb659d", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 11745, "upload_time": "2017-09-21T13:34:43", "url": "https://files.pythonhosted.org/packages/00/56/4ffe849110377287ca65bb618ea90dca6825abb65ddb8b43083eeea7008d/camgrab-0.9.1-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "918ede99b972e56ffc9119c14f483144", "sha256": "f8c17dfa4bcb2cba478c860bd9a2237c98b4762cb23aa4163d28c82eaa30195f" }, "downloads": -1, "filename": "camgrab-0.9.1.tar.gz", "has_sig": false, "md5_digest": "918ede99b972e56ffc9119c14f483144", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 206672, "upload_time": "2017-09-21T13:34:44", "url": "https://files.pythonhosted.org/packages/87/70/4443702b723f6bf5b136609f874eb8ca9a7e9e4ca3082befab3be7bb8a17/camgrab-0.9.1.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "3f0d33bffa3ac4d8d082dad35bcb659d", "sha256": "972d3312e37ae06d16814e598506e97b6d6bf8370671b121b6ea68172f289b9b" }, "downloads": -1, "filename": "camgrab-0.9.1-py3-none-any.whl", "has_sig": false, "md5_digest": "3f0d33bffa3ac4d8d082dad35bcb659d", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 11745, "upload_time": "2017-09-21T13:34:43", "url": "https://files.pythonhosted.org/packages/00/56/4ffe849110377287ca65bb618ea90dca6825abb65ddb8b43083eeea7008d/camgrab-0.9.1-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "918ede99b972e56ffc9119c14f483144", "sha256": "f8c17dfa4bcb2cba478c860bd9a2237c98b4762cb23aa4163d28c82eaa30195f" }, "downloads": -1, "filename": "camgrab-0.9.1.tar.gz", "has_sig": false, "md5_digest": "918ede99b972e56ffc9119c14f483144", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 206672, "upload_time": "2017-09-21T13:34:44", "url": "https://files.pythonhosted.org/packages/87/70/4443702b723f6bf5b136609f874eb8ca9a7e9e4ca3082befab3be7bb8a17/camgrab-0.9.1.tar.gz" } ] }