{ "info": { "author": "Tehnix", "author_email": "ckl@codetalk.io", "bugtrack_url": null, "classifiers": [ "Development Status :: 3 - Alpha", "Environment :: Console", "Intended Audience :: Developers", "Intended Audience :: System Administrators", "License :: OSI Approved :: BSD License", "Operating System :: MacOS :: MacOS X", "Operating System :: POSIX", "Programming Language :: Python :: 3 :: Only", "Topic :: Home Automation" ], "description": "cred\n====\n**cred** (Connected Reactive Electronic Devices), enables you to connect your\nelectronic devices, in a way so that they can communicate with each other\nand react on events happening in the network.\n\n\nAn example application cred would be to connect the devices in a living room. If the light switch is connected, and then turned on it would transmit an event like,\n\n```JSON\n{\n \"device\": \"Light\",\n \"location\": \"Living Room\",\n \"action\": \"Toggled\",\n \"value\": \"On\"\n}\n```\n\nwhich the thermostat would have subscribe to. The server will then transmit this event to the thermostat when it occurs, and the thermostat could act accordingly, like say turning up the temperature in the room since it's most likely going to be occupied now.\n\nUsage\n=====\nSimply install with pip, add a configuration and run it.\n\n1. `$ pip install cred-server`\n3. `$ cred-server`\n\nand test out the API with curl :)\n\n\nGenerating API keys\n=====\nYou can generate API keys with the command line utility `cred-gen`. Make sure\nit is using the same configuration as your server. There are three different permission levels,\n\n| Permission | Access |\n|------------|--------------------------------------|\n| admin | All resources |\n| write | All POST and GET except for API keys |\n| read | All GET except for API keys |\n\nsee `cred-gen --help` for more information on how to use the program.\n\n\nConfiguration\n=====\nIf you don't supply the configuration location via `--config=/path/to/config`, then the configuration files are searched for in the following order:\n 1. Local directory\n 2. Users home directory\n 3. Users app directory\n 4. System app directory\n\nThe file searched for is called credrc for 1., 3. and 4. and.credrc and 2. If none are found, it will use the default configuration.\n\nExample configuration for a local setup with a SQLite3 database:\n\n```yaml\nSSL: False\napproot: '127.0.0.1'\nhost: '*'\nport: 5000\nscheduler: False\nschedulerPeriod: 30\npingtimeout: 240\ndatabase:\n type: 'sqlite3'\n user: ''\n password: ''\n host: ''\n port: ''\n database: 'cred-server.db'\n```\n\nor using PostgreSQL,\n\n```yaml\nSSL: False\napproot: '127.0.0.1'\nhost: '*'\nport: 5000\nscheduler: False\nschedulerPeriod: 30\npingtimeout: 240\ndatabase:\n type: 'postgresql'\n user: 'scott'\n password: 'tiger'\n host: 'localhost'\n port: '5432'\n database: 'mydatabase'\n```\n\n\nAPI\n=====\nThe URL endpoints and their functionality are described below,\n\n| Resource | Method | Function |\n|---------------------------------|--------|-----------|\n| `/auth` | GET | Authenticate the client and return a session key |\n| `/events` | GET | Return IDs of all events, ordered by ID descending |\n| `/events` | POST | Create a new event associated with the client POSTing it |\n| `/events/` | GET | Return full information for a specific event |\n| `/clients` | GET | Return IDs of all clients that are active |\n| `/clients/me` | GET | Return information about the client itself |\n| `/clients/` | GET | Return information about a specific client |\n| `/clients//events` | GET | Return IDs of all events from the client |\n| `/clients//subscribedevents` | GET | Return IDs of all events the client has subscribed to |\n\nThe above resources are accessible with read permissions for all GETs and write for all POSTs and GETs.\n\n| Resource | Method | Function |\n|---------------------------------|--------|----------|\n| `/apikeys` | GET | Return IDs of all API keys |\n| `/apikeys` | POST | Generate a new API key |\n| `/apikeys/` | GET | Return information about a specific API key |\n\nThese resources are special, and require admin permissions.\n\n### Parameters\n\nAdditionally the following query parameters can also be appended to the\nresource, for extra fine-tuning. The parameters below work when using GET\nrequests on the following resources: /events and /clients,\n/clients//events, /clients//subscribedevents and /apikeys.\n\n| Parameter | Function |\n|----------------|----------------------------------------------------|\n| `full=` | Return the full information instead of just IDs |\n| `before=` |\u00a0Returns IDs lower than |\n| `after=` |\u00a0Returns IDs higher than |\n| `limit=` | Limit the number of items to items |\n| `offset=` | Skip number of items before fetching |\n\n\n### Example API Call\n\nAn example call with multiple parameters `/events?full=true&limit=10&offset=10`,\nwhich will pull the full information for 10 events, starting from after the 10\nnewest ones. This can be useful if you want to be able to pull all events and\npaginate them, or something like that. To get the next page, you would then add\nthe `&from=` parameter, with the first ID you got back, and increment the offset\nwith 10 more.\n\nAlternatively, something like `/clients//events?full=true` can be used to\npull the full information for new events that the client has subscribed to.\n\nWith the `after=` parameter, the server now doesn't need to keep track of\nwhen the client last pulled, since the client can control that itself. To give\nan example, a client with ID=145 is doing its first series of requests:\n\n1. The client requests `/clients/145/subscribedevents?full=true&limit=10`\n2. A response with a list of events comes back, the newest being ID=288\n3. The client requests `/clients/145/subscribedevents?from=true&after=288`\n4. A response with all events with ID > 288 comes back\n\nAnd so on. The minimizes the state kept on the server. If step 2. produced no\nresults, the client would set `after=0`, which would still give new events only.\n\n\nDatabase\n=====\ncred uses SQLAlchemy, so it supports the same database that SQLAlchemy does.\nThe `type` setting in the configuration file takes any value that you can find\nat [SQLAlchemy engines](http://docs.sqlalchemy.org/en/latest/core/engines.html \"SQLAlchemy engines\") (like sqlite3,\npostgresql, postgresql+psycopg2, etc.).\n\n\nFrontend\n=====\nYou can check out [cred-web](https://github.com/Tehnix/cred-web \"cred-web repository\") for a pure javascript frontend to the API server. It shows the active clients and all the events that are coming in.\n\n\nClients\n=====\nTo easily create clients that connect to the API server, you can check out the client library at [cred-client](https://github.com/Tehnix/cred-client \"cred-client repository\").\n\n\nDevelopment\n=====\nThe following should get you running:\n\n1. `$ git clone git@github.com:Tehnix/cred-server.git && cd cred-server`\n2. `$ virtualenv env && source env/bin/activate`\n3. `$ pip install -r requirements.txt`\n4. Run tests with `nosetests` and alternatively with `--with-watch` (detects file changes)\n\nor a one-liner,\n\n```bash\n$ git clone git@github.com:Tehnix/cred-server.git && cd cred-server && virtualenv env && source env/bin/activate && pip install -r requirements.txt\n```\n", "description_content_type": null, "docs_url": null, "download_url": "https://github.com/Tehnix/cred-server/tarball/v0.3.0", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/Tehnix/cred-server", "keywords": null, "license": "BSD", "maintainer": null, "maintainer_email": null, "name": "cred-server", "package_url": "https://pypi.org/project/cred-server/", "platform": "UNKNOWN", "project_url": "https://pypi.org/project/cred-server/", "project_urls": { "Download": "https://github.com/Tehnix/cred-server/tarball/v0.3.0", "Homepage": "https://github.com/Tehnix/cred-server" }, "release_url": "https://pypi.org/project/cred-server/0.3.0/", "requires_dist": null, "requires_python": null, "summary": "Connected Reactive Electronic Devices.", "version": "0.3.0" }, "last_serial": 1607282, "releases": { "0.2.10": [ { "comment_text": "", "digests": { "md5": "7016062aec5dd9caf2260c2073d430c9", "sha256": "5c72e4d3a612b09b4e437c7cd69870e593904e20cd2122fd59e92107de69a8ae" }, "downloads": -1, "filename": "cred-server-0.2.10.tar.gz", "has_sig": false, "md5_digest": "7016062aec5dd9caf2260c2073d430c9", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 16224, "upload_time": "2015-05-22T19:49:40", "url": "https://files.pythonhosted.org/packages/fa/13/3cfd52def7b8ab8a54e0f967f74ae718f8ac4b56121c394dc4efb4d6ac79/cred-server-0.2.10.tar.gz" } ], "0.2.11": [ { "comment_text": "", "digests": { "md5": "6472e558cf535a09e80efba118f912e1", "sha256": "f38c0356eb74ed3f5b57ad1b57572506e22f1d36aa15f00ccd1e0894ff12ed04" }, "downloads": -1, "filename": "cred-server-0.2.11.tar.gz", "has_sig": false, "md5_digest": "6472e558cf535a09e80efba118f912e1", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 16226, "upload_time": "2015-05-22T19:51:35", "url": "https://files.pythonhosted.org/packages/63/50/0afc2170e60419b44d2232140eafd2fe00030ad0f7431422fec2c0f75320/cred-server-0.2.11.tar.gz" } ], "0.2.12": [ { "comment_text": "", "digests": { "md5": "367cf12e16850cd963fc014509b1ed5f", "sha256": "6d03010bb30f50b886540f8a7ca1cf1ac48bf978ae53441d4cfa760bb19461f3" }, "downloads": -1, "filename": "cred-server-0.2.12.tar.gz", "has_sig": false, "md5_digest": "367cf12e16850cd963fc014509b1ed5f", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 16516, "upload_time": "2015-05-24T08:43:45", "url": "https://files.pythonhosted.org/packages/7e/19/ebe1b83dcf6baa40b5694925822bcc03c984ec1f9b26015ffe607572f522/cred-server-0.2.12.tar.gz" } ], "0.2.15": [ { "comment_text": "", "digests": { "md5": "51ffd6d46927648d1143714cc791701b", "sha256": "d6bd56fa84124506842fd261e1baaa9c9650eeb08ee15a8823875a1c1e9b8ca0" }, "downloads": -1, "filename": "cred-server-0.2.15.tar.gz", "has_sig": false, "md5_digest": "51ffd6d46927648d1143714cc791701b", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 16658, "upload_time": "2015-06-16T22:42:38", "url": "https://files.pythonhosted.org/packages/a5/30/c68df196dc9fbf4a7e62f3dda9d5153b863516a13166214cf7015734803c/cred-server-0.2.15.tar.gz" } ], "0.2.16": [ { "comment_text": "", "digests": { "md5": "40fc039ee2bb1755a97bc64637899e03", "sha256": "43356a63c0d14939d72e18fa66e3c9f66802144e81bb97620997efc9f7c3361e" }, "downloads": -1, "filename": "cred-server-0.2.16.tar.gz", "has_sig": false, "md5_digest": "40fc039ee2bb1755a97bc64637899e03", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 16647, "upload_time": "2015-06-17T03:29:29", "url": "https://files.pythonhosted.org/packages/e4/70/8d5e0ce7ed7cd048a326267c8b6c77528e52985722e485ebb1481946e4bd/cred-server-0.2.16.tar.gz" } ], "0.2.17": [ { "comment_text": "", "digests": { "md5": "4a84e702d630ba40c4fce6f10350f058", "sha256": "0e52b60f532021dee691bf79acf4557328c1ca9433e90d56755002004f8ec7aa" }, "downloads": -1, "filename": "cred-server-0.2.17.tar.gz", "has_sig": false, "md5_digest": "4a84e702d630ba40c4fce6f10350f058", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 16697, "upload_time": "2015-06-19T01:33:19", "url": "https://files.pythonhosted.org/packages/f3/40/9b8475e30c5d8a0826dc7e853792dc946983bbc88ea0ecdc4bd8f6158a15/cred-server-0.2.17.tar.gz" } ], "0.2.18": [ { "comment_text": "", "digests": { "md5": "3a76fa4349eeb1199be869b60b36ee29", "sha256": "86bd3c1f625b23d5464bfde505badac5efa3ecf4521707a156deb5e443618119" }, "downloads": -1, "filename": "cred-server-0.2.18.tar.gz", "has_sig": false, "md5_digest": "3a76fa4349eeb1199be869b60b36ee29", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 16708, "upload_time": "2015-06-19T01:50:39", "url": "https://files.pythonhosted.org/packages/cb/a0/d6af817abfc240bce9d5b9909f085854a18616a29ae62ae29008dded0f14/cred-server-0.2.18.tar.gz" } ], "0.2.19": [ { "comment_text": "", "digests": { "md5": "69d9625843d146de75e8e73de8e1ac6a", "sha256": "ba242d69b9b6e480d098b5fbea64e239d76a97fb1574980f149829609b8156f6" }, "downloads": -1, "filename": "cred-server-0.2.19.tar.gz", "has_sig": false, "md5_digest": "69d9625843d146de75e8e73de8e1ac6a", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 16688, "upload_time": "2015-06-25T23:59:07", "url": "https://files.pythonhosted.org/packages/20/f5/1f34a88b79bfc8d63d48881ae0cc23ad0899cdc875dae33d95458c9a4e24/cred-server-0.2.19.tar.gz" } ], "0.2.5": [ { "comment_text": "", "digests": { "md5": "d0f691afe9e59958c0f127bc7d1bf604", "sha256": "8e6ecaff3110faf0080c7141d394faa09d408c12325dfd064cc1d621067dcc31" }, "downloads": -1, "filename": "cred-server-0.2.5.tar.gz", "has_sig": false, "md5_digest": "d0f691afe9e59958c0f127bc7d1bf604", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 12269, "upload_time": "2015-05-22T18:39:40", "url": "https://files.pythonhosted.org/packages/54/67/5df38685a4c3ec3ea28654f418c4b33bd63a4fecbfc177470087f1694532/cred-server-0.2.5.tar.gz" } ], "0.2.6": [ { "comment_text": "", "digests": { "md5": "5673da9d03b9c31708b939f81f05e852", "sha256": "0139c60251ec6bced228e8f6cd9f3ef612533f9aa8fe888a7879441c46316e77" }, "downloads": -1, "filename": "cred-server-0.2.6.tar.gz", "has_sig": false, "md5_digest": "5673da9d03b9c31708b939f81f05e852", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 11702, "upload_time": "2015-05-22T18:42:25", "url": "https://files.pythonhosted.org/packages/99/c6/1c5314298452b74fe6666f32d2d0e04eb7082ee781c4ba659b64534b25bf/cred-server-0.2.6.tar.gz" } ], "0.2.7": [ { "comment_text": "", "digests": { "md5": "885b4c49f4646e5b6e5354abe891fe7f", "sha256": "f6259bf821ac0449d3464aadc3c0db951ef39da7c1c6c3a638d836729f1a90e7" }, "downloads": -1, "filename": "cred-server-0.2.7.tar.gz", "has_sig": false, "md5_digest": "885b4c49f4646e5b6e5354abe891fe7f", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 11740, "upload_time": "2015-05-22T19:36:05", "url": "https://files.pythonhosted.org/packages/fd/08/ca84a5fb3124cc7ad98b96d49d722f0b9be0ed1c08717c56ef6fc82067d4/cred-server-0.2.7.tar.gz" } ], "0.2.8": [ { "comment_text": "", "digests": { "md5": "da7d68ab3b95ea50407b8ca0817a4da5", "sha256": "042a992bd19b31dd78f585a44c0c11aeb386241ec9eb5919423c0557f0376dbc" }, "downloads": -1, "filename": "cred-server-0.2.8.tar.gz", "has_sig": false, "md5_digest": "da7d68ab3b95ea50407b8ca0817a4da5", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 11737, "upload_time": "2015-05-22T19:39:11", "url": "https://files.pythonhosted.org/packages/de/16/1adbdaad4700389b03a0528d1a2973f67d7b347fc5fe5f94720ba7c8983d/cred-server-0.2.8.tar.gz" } ], "0.2.9": [ { "comment_text": "", "digests": { "md5": "406b31d34feb81cbc685a59ae3559d45", "sha256": "7f988053e85086389fcd9a7531f300f98b8cefcbab26b9a146da83f5906f4190" }, "downloads": -1, "filename": "cred-server-0.2.9.tar.gz", "has_sig": false, "md5_digest": "406b31d34feb81cbc685a59ae3559d45", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 11734, "upload_time": "2015-05-22T19:45:04", "url": "https://files.pythonhosted.org/packages/53/02/bc5067132e5e02f3e3f7aabc6a50fabf84e121f96a315f2e5757e9f1f00c/cred-server-0.2.9.tar.gz" } ], "0.3.0": [ { "comment_text": "", "digests": { "md5": "87322a9c8d4362adac3ba6b3091369b4", "sha256": "e1f12e9b7c8f2cba233e3dc6004ca23a7a4b9d3d7c2a676655b8337ac1e55269" }, "downloads": -1, "filename": "cred-server-0.3.0.tar.gz", "has_sig": false, "md5_digest": "87322a9c8d4362adac3ba6b3091369b4", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 16677, "upload_time": "2015-06-26T01:48:20", "url": "https://files.pythonhosted.org/packages/84/1c/e47996a3f940da4dc7c25c016c7b635eba3b4c4384bf6bfefc84753dae9b/cred-server-0.3.0.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "87322a9c8d4362adac3ba6b3091369b4", "sha256": "e1f12e9b7c8f2cba233e3dc6004ca23a7a4b9d3d7c2a676655b8337ac1e55269" }, "downloads": -1, "filename": "cred-server-0.3.0.tar.gz", "has_sig": false, "md5_digest": "87322a9c8d4362adac3ba6b3091369b4", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 16677, "upload_time": "2015-06-26T01:48:20", "url": "https://files.pythonhosted.org/packages/84/1c/e47996a3f940da4dc7c25c016c7b635eba3b4c4384bf6bfefc84753dae9b/cred-server-0.3.0.tar.gz" } ] }