{ "info": { "author": "Anthony Seliga", "author_email": "anthony.seliga@gmail.com", "bugtrack_url": null, "classifiers": [], "description": "# pydevice\nPython interface for the Device Magic API\n\n## Installation\n\nPyPi:\n\n```python\npip install pydevice\n```\n\nGit:\n\n```python\ngit clone https://github.com/aseli1/pydevice.git\ncd pydevice\npython setup.py install\n```\nTested on Python 3.6 -- works on Mac\n\n## Usage\n```python\n>>> from pydevice import DeviceMagic\n>>> args = {'org_id': 3000,'database_id': 580, 'form_id': 6000, 'resource_id': 103, 'file_path': 'path/to/file'}\n>>> dm = DeviceMagic(args)\n>>> dm.form.all() # destination, device, resource, group, and dispatch also have this method\n{'forms': [{'id': 40015631, 'name': 'Daily Report'...}\n```\n\n## Authentication\nAuthentication is handled by the DeviceMagic class. The class can handle authentication automatically if the environment variable DEVICEMAGIC_API_KEY is set with your api key.\n```python\n>>> import os\n>>> os.environ['DEVICEMAGIC_API_KEY'] = 'Basic c3ppZhh39fj3Wjk6eA=='\n>>> dm = DeviceMagic(args)\n```\nIn preference, you can pass the key explicitly:\n```python\n>>> dm = DeviceMagic({'api_key': 'Basic c3ppZhh39fj3Wjk6eA=='})\n```\n\n### Database\n```python\n>>> args = {'database_id': 500}\n>>> dm = DeviceMagic(args)\n>>>\n>>> dm.database.json() # All submissions\n{'per_page': 30, 'current_page': 1, 'total_pages': 1, 'current_count': 13, 'total_count': 13, 'submissions': [{'form'...\n>>>\n>>> dm.database.json(\"from_date=2018-5-1 00:00\", \"to_date=2018-5-31 00:00\") # Filter submissions\n{...'total_count': 1, 'submissions': [{'form': {'id': 6009105, 'name': 'Sales Report'...}\n```\n\n### Destination\n```python\n>>> args = {'form_id': 700}\n>>> dm = DeviceMagic(args)\n>>>\n>>> from some_file import destination_json\n>>> docx_to_email = 17443 # Destination id\n>>> google_sheet = 17465\n>>> old_destination = 17432\n>>> new_form = 8475\n>>>\n>>> dm.destination.all() # All form destinations\n{'destinations': [{'id': 17442, 'description': None, 'active': True...}]}\n>>>\n>>> dm.destination.details(docx_to_email)\n{'destination': {'id': 17443, 'description': '', 'active': True, 'form_id': 7225921, 'format_type': 'word_format', 'format_id': 14990, 'transport_type': 'email_transport'...\n>>>\n>>> dm.destination.create(destination_json) # Create a destination\n>>>\n>>> dm.destination.update(google_sheet, destination_json)\n>>>\n>>> dm.destination.delete(old_destination)\n>>>\n>>> dm.destination.copy(docx_to_email) # Copy a destination\n>>> dm.destination.copy(docx_to_email, form_id=new_form) # Copy to another form\n```\n\n### Device\n```python\n>>> args = {'org_id': 800}\n>>> dm = DeviceMagic(args)\n>>>\n>>> omaha_tablet = 281 # Device id\n>>> new_device = 543\n>>> old_device = 93\n>>>\n>>> dm.device.all() # All devices in organization\n{'devices': [{'id': 281, 'identifier': 'Android_d5c2a9d...\n>>>\n>>> dm.device.details(omaha_tablet) # Device details\n{'id': 281, 'identifier': 'Android_d5c2a9d...\n>>>\n>>> dm.device.delete(old_device)\n>>>\n>>> dm.device.approve(new_device)\n>>>\n>>> device_json = {\n 'device':{\n 'owner':'Audrey',\n 'description':'Abroad helping others',\n 'groups':'Outreach'\n }\n }\n>>>\n>>> dm.device.update(new_device, device_json) # Change device name, description and group(s)\n```\n\n### Form\n```python\n>>> args = {'org_id': 800}\n>>> dm = DeviceMagic(args)\n>>>\n>>> from some_file import group_json\n>>> site_survey = 400 # Form id\n>>> old_form = 235\n>>>\n>>> dm.form.all() # All forms in organization\n{'forms': [{'id': 400, 'name': 'Site Survey'...\n>>>\n>>> dm.form.details(site_survey)\n{'type': 'root', 'children': [{'identifier': 'Time_on_site'...\n>>>\n>>> with open('form.json') as json:\n... dm.form.create(json.read())\n... \n'Form created'\n>>>\n>>> dm.form.update(site_survey, form_json)\n>>>\n>>> dm.form.delete(old_form)\n>>>\n>>> dm.form.new_group(site_survey, group_json) # Change form group\n```\n\n### Resource\n```python\n>>> args = {'file_path': 'path/to/material_list.xlsx'}\n>>> dm = DeviceMagic(args)\n>>>\n>>> cost_of_material = 7898 # Resource id\n>>> customer_list = 9789\n>>> old_resource = 6778\n>>>\n>>> dm.resource.all() # All organization resources\n{'resources': [{'id': 6958, 'original_filename': 'Equipment List.xlsx...'}\n>>>\n>>> dm.resource.details(customer_list) \n{'resource': {'id': 9789, 'identifier': '52945f50-408...'}\n>>>\n>>> dm.resource.download(customer_list) # Download file\n>>>\n>>> dm.resource.create('Copy of all materials', 'material_list.xlsx') # Create a resource\n>>>\n>>> dm.resource.update(cost_of_material, 'With updated pricing', 'cost_of_material.xlsx')\n>>>\n>>> dm.resource.delete(old_resource)\n```\n\n### Group\n```python\n>>> args = {'org_id': 400}\n>>> dm = DeviceMagic(args)\n>>>\n>>> from some_file import group_json\n>>> old_group = 879 # Group id\n>>> technician = 900\n>>>\n>>> dm.group.all() # All organization groups\n{'groups': [{'id': 3643, 'name': 'Engineer', 'form_ids': [...]}\n>>>\n>>> dm.group.create(group_json) # Create a group\n>>>\n>>> dm.group.update(technician, group_json)\n>>>\n>>> dm.group.delete(old_group)\n```\n\n### Dispatch\n```python\n>>> args = {'org_id': 600}\n>>> dm = DeviceMagic(args)\n>>> \n>>> from some_file import dispatch_json\n>>> new_brunswick_tab = 'Android_d5c2a9db-7c7e-465b'\n>>> ontario_phone = 'iPhone_8775938_48795749'\n>>> service_call = 13434 # Oneshot id\n>>> old_dispatch = 11947\n>>>\n>>> dm.dispatch.all() # All outstanding dispatches\n'[{\"form\": {\"id\": 72343, \"name\": \"Daily Inspection\",\"namespace\"...'\n>>>\n>>> dm.dispatch.push(new_brunswick, dispatch_json) # Dispatch a form\n>>>\n>>> dm.dispatch.update(new_brunswick, service_call, dispatch_json)\n>>>\n>>> dm.dispatch.delete(ontario_phone, oneshot_id=old_dispatch) # Delete a single dispatch\n>>>\n>>> dm.dispatch.delete(ontario_phone) # Remove all\n```\n\n[Official Device Magic API docs](https://docs.devicemagic.com/create-custom-integrations-with-our-restapi)\n\n\n", "description_content_type": "text/markdown", "docs_url": null, "download_url": "", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/aseli1/pydevice", "keywords": "", "license": "MIT", "maintainer": "", "maintainer_email": "", "name": "pydevice", "package_url": "https://pypi.org/project/pydevice/", "platform": "", "project_url": "https://pypi.org/project/pydevice/", "project_urls": { "Homepage": "https://github.com/aseli1/pydevice" }, "release_url": "https://pypi.org/project/pydevice/0.1.6/", "requires_dist": [ "requests", "vcrpy", "pytest" ], "requires_python": ">3.0", "summary": "Device Magic API Wrapper", "version": "0.1.6" }, "last_serial": 4176875, "releases": { "0.1.0": [ { "comment_text": "", "digests": { "md5": "1ba6ca0d22694490de8fea54506a7f77", "sha256": "f4d7cf90bbddddf7b25384f5d3c31dedbf1d18547076bdfb86e2c65866a0b94e" }, "downloads": -1, "filename": "pydevice-0.1.0-py3-none-any.whl", "has_sig": false, "md5_digest": "1ba6ca0d22694490de8fea54506a7f77", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": ">3.0", "size": 10801, "upload_time": "2018-05-28T01:53:37", "url": "https://files.pythonhosted.org/packages/c5/85/caf4912fbd65a5a9ae32f70380249a6273442ab34ddfde6b902afaaf3574/pydevice-0.1.0-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "95268d916be249ace180dedea67368eb", "sha256": "b5ef747d60b21b6b93563ca2ad945b69618dd5edd8fc472f52b8c8371302cc6a" }, "downloads": -1, "filename": "pydevice-0.1.0.tar.gz", "has_sig": false, "md5_digest": "95268d916be249ace180dedea67368eb", "packagetype": "sdist", "python_version": "source", "requires_python": ">3.0", "size": 4318, "upload_time": "2018-05-28T01:53:38", "url": "https://files.pythonhosted.org/packages/85/06/b435b9cfc14af678751d978605b9a4660adb0bafa6ac75d3fb143375776c/pydevice-0.1.0.tar.gz" } ], "0.1.1": [ { "comment_text": "", "digests": { "md5": "dcd755499952d17f78011c3a93c7b0f0", "sha256": "0afecb6d8c3f34f2662f03fe9fd174d6dc41810e9b76561e97a49ad79da5de89" }, "downloads": -1, "filename": "pydevice-0.1.1-py3-none-any.whl", "has_sig": false, "md5_digest": "dcd755499952d17f78011c3a93c7b0f0", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": ">3.0", "size": 12156, "upload_time": "2018-05-29T14:51:33", "url": "https://files.pythonhosted.org/packages/09/9d/d282034dd497ebff29682eeaec643dff2fef0e59f46538849583b2d8cb3e/pydevice-0.1.1-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "efcd1909586c75e1178e85e92e050d55", "sha256": "802476944fb3c0920c4c2874c6dcecb0588dff0bfb52dbc279aa04b6db1d5378" }, "downloads": -1, "filename": "pydevice-0.1.1.tar.gz", "has_sig": false, "md5_digest": "efcd1909586c75e1178e85e92e050d55", "packagetype": "sdist", "python_version": "source", "requires_python": ">3.0", "size": 4843, "upload_time": "2018-05-29T14:51:34", "url": "https://files.pythonhosted.org/packages/e9/42/c75f13c271326b2bac2a261728d5f16cdc85da5e67ab01f7908f034a6f89/pydevice-0.1.1.tar.gz" } ], "0.1.2": [ { "comment_text": "", "digests": { "md5": "47dd98d444c54282976e300993f5b186", "sha256": "b3950a65d6901b56fdc06d0e94175ed8fc576a036549026a7484014d669660ba" }, "downloads": -1, "filename": "pydevice-0.1.2-py3-none-any.whl", "has_sig": false, "md5_digest": "47dd98d444c54282976e300993f5b186", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": ">3.0", "size": 12243, "upload_time": "2018-05-31T02:30:01", "url": "https://files.pythonhosted.org/packages/26/34/c3022c41178fb076bfe341accc5dc6606a912c225dd8c461f1b39f3f6f74/pydevice-0.1.2-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "427349c8ac62b357cf97f29242e12cfe", "sha256": "1edbbe68b2fac5a2cc979a3a97824a5779dbca4afe6e626b26eed78d111ba157" }, "downloads": -1, "filename": "pydevice-0.1.2.tar.gz", "has_sig": false, "md5_digest": "427349c8ac62b357cf97f29242e12cfe", "packagetype": "sdist", "python_version": "source", "requires_python": ">3.0", "size": 4926, "upload_time": "2018-05-31T02:30:02", "url": "https://files.pythonhosted.org/packages/8c/77/becbeb74d46d08bd9bbdaaa9a3ae1503dc7c4f31c41ffce14a7339796b66/pydevice-0.1.2.tar.gz" } ], "0.1.3": [ { "comment_text": "", "digests": { "md5": "265f13f1cbb57c1b5a170437e67ff0c0", "sha256": "21aff1a076216c870308d485c74fece655a1d0b656fab7db996dd6b48c611be7" }, "downloads": -1, "filename": "pydevice-0.1.3-py3-none-any.whl", "has_sig": false, "md5_digest": "265f13f1cbb57c1b5a170437e67ff0c0", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": ">3.0", "size": 12244, "upload_time": "2018-06-01T15:57:02", "url": "https://files.pythonhosted.org/packages/9a/8f/589060f6cc838dbfb247288d7f71fbf0c3f4a001975b19a07e4add5d184e/pydevice-0.1.3-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "a2fa72fa2ae8346a25fd9cfe6880c924", "sha256": "49513c38a57b2c1e8c2a16afb21d9786f8e067da42a9df6de4b8a78d815a04a6" }, "downloads": -1, "filename": "pydevice-0.1.3.tar.gz", "has_sig": false, "md5_digest": "a2fa72fa2ae8346a25fd9cfe6880c924", "packagetype": "sdist", "python_version": "source", "requires_python": ">3.0", "size": 4866, "upload_time": "2018-06-01T15:57:04", "url": "https://files.pythonhosted.org/packages/9b/98/69ab69d0faff09dae821f72f21cb1f314179c5aa62df85a3785274a4bfdb/pydevice-0.1.3.tar.gz" } ], "0.1.4": [ { "comment_text": "", "digests": { "md5": "575f75860790ef932aa7faa2a00b45a6", "sha256": "9d443a3c848cfe82f5b59f228c47e955e62ae548f30094f0295dbc466fc7f5dc" }, "downloads": -1, "filename": "pydevice-0.1.4-py3-none-any.whl", "has_sig": false, "md5_digest": "575f75860790ef932aa7faa2a00b45a6", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": ">3.0", "size": 12274, "upload_time": "2018-06-04T19:02:01", "url": "https://files.pythonhosted.org/packages/2d/71/47a3ec5b1abec8cb81297a5e438cc13be66e8f2f7b2124bddc69f3ad6d29/pydevice-0.1.4-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "86ccdb8ee3e6a38c1a5ad94591b21e45", "sha256": "389a997eb3c54c5dbe4dc5dccdacce118e9042fe50844ed5cdd3c0ad405bcb6c" }, "downloads": -1, "filename": "pydevice-0.1.4.tar.gz", "has_sig": false, "md5_digest": "86ccdb8ee3e6a38c1a5ad94591b21e45", "packagetype": "sdist", "python_version": "source", "requires_python": ">3.0", "size": 4901, "upload_time": "2018-06-04T19:02:03", "url": "https://files.pythonhosted.org/packages/9e/12/04a160c68ed601cc893ea3fdca59c6cf73579252b571e7db6b5a3984f809/pydevice-0.1.4.tar.gz" } ], "0.1.5": [ { "comment_text": "", "digests": { "md5": "9ec189ae06908507828a2543a72d3578", "sha256": "187679f5e439f102f7a6ccd874282523ae3ebf77f5a6946f4f8bab2ab3ca5ba0" }, "downloads": -1, "filename": "pydevice-0.1.5-py3-none-any.whl", "has_sig": false, "md5_digest": "9ec189ae06908507828a2543a72d3578", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": ">3.0", "size": 13235, "upload_time": "2018-08-14T02:16:49", "url": "https://files.pythonhosted.org/packages/7f/b8/113357660a8a57b9307b252bf56fe72ec72f67748e427b865da4c297e03d/pydevice-0.1.5-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "03ed53044601d7a52f427f32b2ae0d44", "sha256": "7fde54e571adffcf485cd6b459d99b617597684d02368b1aebdb65cd16e8e5f4" }, "downloads": -1, "filename": "pydevice-0.1.5.tar.gz", "has_sig": false, "md5_digest": "03ed53044601d7a52f427f32b2ae0d44", "packagetype": "sdist", "python_version": "source", "requires_python": ">3.0", "size": 6151, "upload_time": "2018-08-14T02:19:16", "url": "https://files.pythonhosted.org/packages/d0/03/514fe2865ef9f8e06cc28705d8a1697f3ab3099c6275433f3baf85b774e8/pydevice-0.1.5.tar.gz" } ], "0.1.6": [ { "comment_text": "", "digests": { "md5": "4a188940af25151707c34279fc044b35", "sha256": "74d0edb5f75130eda531d4ae3bfd352c2e5b02c363ea27b8b956f00fd712d850" }, "downloads": -1, "filename": "pydevice-0.1.6-py3-none-any.whl", "has_sig": false, "md5_digest": "4a188940af25151707c34279fc044b35", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": ">3.0", "size": 13185, "upload_time": "2018-08-16T14:40:01", "url": "https://files.pythonhosted.org/packages/93/f0/1ed3a933228533a93ec7e0fe643ff3cb5f5a5496f23be18a1a598dcc5909/pydevice-0.1.6-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "6d4df1fe155cbfbfc8d414405c738574", "sha256": "3b17ad8cf17a97a0cc9ba4789865a549125ac889b955cd85d0de964597cde8aa" }, "downloads": -1, "filename": "pydevice-0.1.6.tar.gz", "has_sig": false, "md5_digest": "6d4df1fe155cbfbfc8d414405c738574", "packagetype": "sdist", "python_version": "source", "requires_python": ">3.0", "size": 6103, "upload_time": "2018-08-16T14:40:03", "url": "https://files.pythonhosted.org/packages/8a/d7/d297da02a37f603036d04c839de4a7b1baf421fe8a0072cd61ff3743f9b0/pydevice-0.1.6.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "4a188940af25151707c34279fc044b35", "sha256": "74d0edb5f75130eda531d4ae3bfd352c2e5b02c363ea27b8b956f00fd712d850" }, "downloads": -1, "filename": "pydevice-0.1.6-py3-none-any.whl", "has_sig": false, "md5_digest": "4a188940af25151707c34279fc044b35", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": ">3.0", "size": 13185, "upload_time": "2018-08-16T14:40:01", "url": "https://files.pythonhosted.org/packages/93/f0/1ed3a933228533a93ec7e0fe643ff3cb5f5a5496f23be18a1a598dcc5909/pydevice-0.1.6-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "6d4df1fe155cbfbfc8d414405c738574", "sha256": "3b17ad8cf17a97a0cc9ba4789865a549125ac889b955cd85d0de964597cde8aa" }, "downloads": -1, "filename": "pydevice-0.1.6.tar.gz", "has_sig": false, "md5_digest": "6d4df1fe155cbfbfc8d414405c738574", "packagetype": "sdist", "python_version": "source", "requires_python": ">3.0", "size": 6103, "upload_time": "2018-08-16T14:40:03", "url": "https://files.pythonhosted.org/packages/8a/d7/d297da02a37f603036d04c839de4a7b1baf421fe8a0072cd61ff3743f9b0/pydevice-0.1.6.tar.gz" } ] }