{ "info": { "author": "Josh Yaganeh", "author_email": "jyaganeh@esri.com", "bugtrack_url": null, "classifiers": [ "Development Status :: 4 - Beta", "Environment :: Console", "Environment :: Web Environment", "Intended Audience :: Developers", "License :: OSI Approved :: Apache Software License", "Operating System :: OS Independent", "Programming Language :: Python" ], "description": "geotrigger-python\n=================\n\nA simple Python client library for interacting with the ArcGIS\nGeotrigger Service via the ``GeotriggerClient`` object.\n\nThe Geotrigger Service is a cloud-hosted geofencing platform, which\nsends push notifications or notifies a remote server when a device\nenters or exits an area.\n\nThe Geotrigger API manages Application and Device information and\npermissions, as well as providing access to create, update, and list\ninformation about Triggers, Tags, and Device Locations.\n\nFor more information please refer to the `Geotrigger Service\nDocumentation `__.\n\nFeatures\n--------\n\n- Handles authentication and refreshing of credentials\n- Supports making requests as an application, allowing for full\n management of devices, triggers, tags, and permissions\n- Also supports making requests as a device, which can be useful for\n testing purposes\n\nDependencies\n------------\n\n- Requests (>= 2.1.0)\n\nFor running tests, you'll also need:\n\n- Mock (>= 1.0.1)\n\nInstallation\n------------\n\nYou can install ``geotrigger-python`` from PyPI using the following\ncommand:\n\n.. code:: bash\n\n pip install geotrigger-python\n\nIt's also possible to install from a clone of this repository by running\n``setup.py install`` or ``setup.py develop``.\n\nExamples\n--------\n\nUsing the GeotriggerClient as an application\n~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n\nThis method of using the `GeotriggerClient` is for server-side apps, acting as\nthe sole owner of your ArcGIS application.\n\nBefore continuing, you'll need to find the ``client_id`` and\n``client_secret`` for your ArcGIS application on the `ArcGIS for\nDevelopers `__ site.\nYou'll find them in the *API Access* section of your applications\ndetails.\n\n**Please make sure to keep your client\\_secret secure.** If a third\nparty obtains your client secret, the will be able to do anything they\nwant to your Geotrigger application. Your ``client_secret`` should only\nbe included in server-side applications and should never be distributed\nas part of a client-side web or mobile application.\n\nYou will need to fill in values for the variable names given in\nall-caps.\n\n.. code:: python\n\n from geotrigger import GeotriggerClient\n\n # Create a GeotriggerClient as an Application\n gt = GeotriggerClient(CLIENT_ID, CLIENT_SECRET)\n\n # Fetch a list of all triggers in this application.\n triggers = gt.request('trigger/list')\n\n # Print all the triggers and any tags applied to them.\n print \"\\nFound %d triggers:\" % len(triggers['triggers'])\n for t in triggers['triggers']:\n print \"- %s (%s)\" % (t['triggerId'], \",\".join(t['tags']))\n\n # Add \"testing123\" tag to all of the triggers that we fetched above.\n triggers_updated = gt.request('trigger/update', {\n 'triggerIds': [t['triggerId'] for t in triggers['triggers']],\n 'addTags': TAG\n })\n\n # Print the updated triggers.\n print \"\\nUpdated %d triggers:\" % len(triggers_updated['triggers'])\n for t in triggers_updated['triggers']:\n print \"- %s (%s)\" % (t['triggerId'], \",\".join(t['tags']))\n\n # Delete the \"testing123\" tag from the application.\n tags_deleted = gt.request('tag/delete', {'tags': TAG})\n print '\\nDeleted tags: \"%s\"' % \", \".join(tags_deleted.keys())\n\nUsing the GeotriggerClient as a Device\n~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n\nThe ``GeotriggerClient`` can also be used as if it were a device, which\nwill allow you to send location updates and fire triggers, but you will\nnot be able to receive any Geotrigger notifications, because they are sent as\npush messages to actual mobile devices. You can use the\n`trigger/history `__\nAPI route or configure your triggers with a ``callbackUrl`` in order to\nobserve that triggers are being fired.\n\nYou'll only need the ``client_id`` for your application in order to use\nthe ``GeotriggerClient`` as a device.\n\nFor testing callback triggers, you can use the handy\n`RequestBin `__ service. Create a new bin and\nprovide its URL as the ``callbackUrl`` when creating a trigger.\n\nYou will need to fill in values for the variable names given in\nall-caps.\n\n.. code:: python\n\n from geotrigger import GeotriggerClient\n\n # Create a GeotriggerClient as a device\n gt = GeotriggerClient(CLIENT_ID)\n\n # Default tags are created for all devices and triggers. Device default tags\n # can be used when you want to allow devices to create triggers that only they\n # can fire. Default tags look like: 'device:device_id' or 'trigger:trigger_id'\n device_tag = 'device:%s' % gt.session.device_id\n\n # Build a callback trigger, using your default tag and RequestBin URL.\n esri_hq = {\n 'condition': {\n 'geo': {\n 'latitude': 34.0562,\n 'longitude': -117.1956,\n 'distance': 100\n },\n 'direction': 'enter'\n },\n 'action': {\n 'callbackUrl': CALLBACK_URL\n },\n 'setTags': device_tag\n }\n\n # Post the trigger to the Geotrigger API\n trigger = gt.request('trigger/create', esri_hq)\n print trigger\n\n # Construct a fake location update to send to the Geotrigger API.\n # Supplying a previous location is not strictly required, but will speed up\n # trigger processing by avoiding a database lookup.\n location_update = {\n 'previous': {\n 'timestamp': datetime.now().isoformat(),\n 'latitude': 45.5165,\n 'longitude': -122.6764,\n 'accuracy': 5,\n },\n 'locations': [\n {\n 'timestamp': datetime.now().isoformat(),\n 'latitude': 34.0562,\n 'longitude': -117.1956,\n 'accuracy': 5,\n }\n ]\n }\n\n # Send the location update.\n update_response = gt.request('location/update', location_update)\n print update_response\n\nShortly after running the above code, you will see a POST to your\ncallback url.\n\nAdvanced GeotriggerClient usage\n~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n\nIf you already have an ArcGIS Application ``access_token`` that you'd\nlike to use to create a ``GeotriggerClient``, pass in a\n``GeotriggerApplication`` as the ``session`` kwarg. You may want to do this if\nyou are integrating Geotrigger functionality into an application that\nalready obtains credentials from ArcGIS Online.\n\nSimilarly, if you want to impersonate an existing device for which you\nalready have a ``client_id``, ``device_id``, ``access_token``, and\n``refresh_token``, you can create your own ``GeotriggerDevice`` to pass\ninto the ``GeotriggerClient``. This can be used to debug apps that are\nbeing developed with the Geotrigger SDKs for Android and iOS.\n\n.. code:: python\n\n from geotrigger import GeotriggerClient, GeotriggerApplication, GeotriggerDevice\n\n app = GeotriggerApplication(CLIENT_ID, CLIENT_SECRET, ACCESS_TOKEN)\n app_client = GeotriggerClient(session=app)\n\n device = GeotriggerDevice(CLIENT_ID, DEVICE_ID, ACCESS_TOKEN, REFRESH_TOKEN)\n device_client = GeotriggerClient(session=device)\n\nIssues\n~~~~~~\n\nFind a bug or want to request a new feature? Please let us know by submitting an issue.\n\nContributing\n~~~~~~~~~~~~\n\nEsri welcomes contributions from anyone and everyone. Please see our `guidelines for contributing `__.\n\nLicensing\n~~~~~~~~~\n\nCopyright 2013 Esri\n\nLicensed under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License.\nYou may obtain a copy of the License at\n\n http://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software\ndistributed under the License is distributed on an \"AS IS\" BASIS,\nWITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\nSee the License for the specific language governing permissions and\nlimitations under the License.\n\nA copy of the license is available in the LICENSE file.", "description_content_type": null, "docs_url": null, "download_url": "UNKNOWN", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/esri/geotrigger-python", "keywords": null, "license": "UNKNOWN", "maintainer": null, "maintainer_email": null, "name": "geotrigger-python", "package_url": "https://pypi.org/project/geotrigger-python/", "platform": "UNKNOWN", "project_url": "https://pypi.org/project/geotrigger-python/", "project_urls": { "Download": "UNKNOWN", "Homepage": "https://github.com/esri/geotrigger-python" }, "release_url": "https://pypi.org/project/geotrigger-python/0.1.1/", "requires_dist": null, "requires_python": null, "summary": "A simple client library for interacting with the ArcGIS Geotrigger API.", "version": "0.1.1" }, "last_serial": 1845469, "releases": { "0.1.0": [ { "comment_text": "", "digests": { "md5": "7c5ceba4094fea608cea021bba6532d2", "sha256": "2c46fb05215b102e501133a16a1bb058b73bf0e6cc614103503695973244708b" }, "downloads": -1, "filename": "geotrigger-python-0.1.0.macosx-10.9-x86_64.exe", "has_sig": false, "md5_digest": "7c5ceba4094fea608cea021bba6532d2", "packagetype": "bdist_wininst", "python_version": "any", "requires_python": null, "size": 80617, "upload_time": "2013-12-16T23:27:52", "url": "https://files.pythonhosted.org/packages/b9/c3/7793749dfddd645b914068620d8a72d33df896ecfa429604684316c89a69/geotrigger-python-0.1.0.macosx-10.9-x86_64.exe" }, { "comment_text": "", "digests": { "md5": "114d80d72683a4027f804dbc922d9c09", "sha256": "60140cd68c4cd44a32429c52d87b40f8d96abb189ccba612975c5cc333d4aa39" }, "downloads": -1, "filename": "geotrigger-python-0.1.0.tar.gz", "has_sig": false, "md5_digest": "114d80d72683a4027f804dbc922d9c09", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 7670, "upload_time": "2013-12-16T23:27:50", "url": "https://files.pythonhosted.org/packages/69/4f/a759cd9e9e1bd0d4c982cfd0bafc71bf1453249c86b9e3abdd5ab1361313/geotrigger-python-0.1.0.tar.gz" } ], "0.1.1": [ { "comment_text": "", "digests": { "md5": "8f6d3107140aec8e918a5b4679b7f428", "sha256": "be2222b379b8a0dc194f80cbc93f37004f2755224cd4ee7b0616fc68887e286e" }, "downloads": -1, "filename": "geotrigger-python-0.1.1.macosx-10.9-x86_64.exe", "has_sig": false, "md5_digest": "8f6d3107140aec8e918a5b4679b7f428", "packagetype": "bdist_wininst", "python_version": "any", "requires_python": null, "size": 80810, "upload_time": "2014-02-19T01:52:11", "url": "https://files.pythonhosted.org/packages/64/f7/e36b0b8d56a5d7926a4d9f48a636c26ccb50400dd37abeeadb06611c5fa0/geotrigger-python-0.1.1.macosx-10.9-x86_64.exe" }, { "comment_text": "", "digests": { "md5": "263e6a5a374873e22f1af503a6398037", "sha256": "046f3267167f02b273fa5fdb00a47dd778ad915c737b499f72283cf7b967fa8d" }, "downloads": -1, "filename": "geotrigger-python-0.1.1.tar.gz", "has_sig": false, "md5_digest": "263e6a5a374873e22f1af503a6398037", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 7867, "upload_time": "2014-02-19T01:52:06", "url": "https://files.pythonhosted.org/packages/bf/ce/3a0339737a236a2d0914362e47e731399904c46de4cc23ec14e55a7bf5a1/geotrigger-python-0.1.1.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "8f6d3107140aec8e918a5b4679b7f428", "sha256": "be2222b379b8a0dc194f80cbc93f37004f2755224cd4ee7b0616fc68887e286e" }, "downloads": -1, "filename": "geotrigger-python-0.1.1.macosx-10.9-x86_64.exe", "has_sig": false, "md5_digest": "8f6d3107140aec8e918a5b4679b7f428", "packagetype": "bdist_wininst", "python_version": "any", "requires_python": null, "size": 80810, "upload_time": "2014-02-19T01:52:11", "url": "https://files.pythonhosted.org/packages/64/f7/e36b0b8d56a5d7926a4d9f48a636c26ccb50400dd37abeeadb06611c5fa0/geotrigger-python-0.1.1.macosx-10.9-x86_64.exe" }, { "comment_text": "", "digests": { "md5": "263e6a5a374873e22f1af503a6398037", "sha256": "046f3267167f02b273fa5fdb00a47dd778ad915c737b499f72283cf7b967fa8d" }, "downloads": -1, "filename": "geotrigger-python-0.1.1.tar.gz", "has_sig": false, "md5_digest": "263e6a5a374873e22f1af503a6398037", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 7867, "upload_time": "2014-02-19T01:52:06", "url": "https://files.pythonhosted.org/packages/bf/ce/3a0339737a236a2d0914362e47e731399904c46de4cc23ec14e55a7bf5a1/geotrigger-python-0.1.1.tar.gz" } ] }