{ "info": { "author": "Matei Trusca", "author_email": "matei.trusca@devlabel.com", "bugtrack_url": null, "classifiers": [ "Intended Audience :: Developers", "License :: OSI Approved :: MIT License", "Programming Language :: Python :: 2.7", "Topic :: Internet :: WWW/HTTP" ], "description": "=============================\nClassowl client documentation\n=============================\n\nContents:\n=========\n\nThis is a client for classowl\\'s RESTful API based on slumber,\na generic REST API client. Slumber turns an expression like::\n\n >>> endpoint.users.me.get(param=2)\n\nor::\n\n >>> endpoint.users('me').get(param=2)\n\ninto an Http request like::\n\n GET /users/me?param=2\n\nor::\n\n >>> endpoint.users('me').put(data)\n\ninto an Http request like::\n\n PUT /users/me\n\nIt also serializes and deserlializes the data automatically \nto and from dictionaries.\n\nIncluded are a factory for a slumber endpoint which provides \nauthentication given a username and password or an access token::\n\n >>> import classowl_client\n >>> client = classowl_client.create('username', 'password')\n >>> client.users.me.get()\n DataObject(**{'email': 'you@host.com',\n 'first_name': 'John',\n 'id': 4387,\n 'is_staff': False,\n 'last_name': 'Smith',\n 'profile': '/api/v1/user_profiles/4381/',\n 'resource_uri': '/api/v1/users/4387/',\n 'token': '2882386636-c50f9414ae284727fc9e'})\n\nor, if you want to persist the token, avoiding repeating the initial login call::\n\n >>> token = classowl_client.get_token('username', 'password')\n >>> token\n '78285b2c479c5f9f73ccca094b7f9307f2648144'\n >>> client = classowl_client.create(token=token)\n >>> client.users.me.get()\n DataObject(**{'email': 'you@host.com',\n 'first_name': 'John',\n 'id': 4387,\n 'is_staff': False,\n 'last_name': 'Smith',\n 'profile': '/api/v1/user_profiles/4381/',\n 'resource_uri': '/api/v1/users/4387/',\n 'token': '2882386636-c50f9414ae284727fc9e'})\n\nA few lazily instantiated shortcuts to the main endpoints for convenience,\nwhich authenticate using the username and password set on the module::\n\n >>> classowl_client.username = 'username'\n >>> classowl_client.password = 'password'\n >>> classowl_client.users.me.get()\n DataObject(**{'email': 'you@host.com',\n 'first_name': 'John',\n 'id': 4387,\n 'is_staff': False,\n 'last_name': 'Smith',\n 'profile': '/api/v1/user_profiles/4381/',\n 'resource_uri': '/api/v1/users/4387/',\n 'token': '2882386636-c50f9414ae284727fc9e'})\n\nA serializer that turns the received data into objects::\n\n >>> account = client.users.me.get()\n >>> account\n DataObject(**{'email': 'you@host.com',\n 'first_name': 'John',\n 'id': 4387,\n 'is_staff': False,\n 'last_name': 'Smith',\n 'profile': '/api/v1/user_profiles/4381/',\n 'resource_uri': '/api/v1/users/4387/',\n 'token': '2882386636-c50f9414ae284727fc9e'})\n >>> account.last_name\n 'Smith'\n\nIts main feature is turning the uri fields into usable endpoints::\n\n >>> account.profile.get()\n DataObject(**{'avatar_url': None,\n 'current_year': None,\n 'department': None,\n 'email_notifications': True,\n 'graduation_year': 2013,\n 'id': 4381,\n 'is_private': False,\n 'is_valid_email': True,\n 'resource_uri': '/api/v1/user_profiles/4381/',\n 'role': 3,\n 'school': '/api/v1/schools/5/',\n 'unread_notifications': 40,\n 'user': '/api/v1/users/4387/',\n 'walkthrough_step': 5})\n\nTo update the information::\n\n >>> account.last_name = 'Brown'\n >>> classowl_client.users.me.put(account)\n DataObject(**{'email': 'you@host.com',\n 'first_name': 'John',\n 'id': 4387,\n 'is_staff': False,\n 'last_name': 'Brown',\n 'pk': 4387,\n 'profile': '/api/v1/user_profiles/4381/',\n 'resource_uri': '/api/v1/users/4387/',\n 'token': '2882386636-c50f9414ae284727fc9e'})\n >>> classowl_client.users.me.get()\n DataObject(**{'email': 'you@host.com',\n 'first_name': 'John',\n 'id': 4387,\n 'is_staff': False,\n 'last_name': 'Brown',\n 'profile': '/api/v1/user_profiles/4381/',\n 'resource_uri': '/api/v1/users/4387/',\n 'token': '2882386636-c50f9414ae284727fc9e'})\n\nYou can get the plain dictionary data from it like so::\n \n >>> dict(account)\n {'email': 'you@host.com',\n 'first_name': 'John',\n 'id': 4387,\n 'is_staff': False,\n 'last_name': 'Smith',\n 'profile': '/api/v1/user_profiles/4381/',\n 'resource_uri': '/api/v1/users/4387/',\n 'token': '2882386636-c50f9414ae284727fc9e'}", "description_content_type": null, "docs_url": "https://pythonhosted.org/classowl-client/", "download_url": "UNKNOWN", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "http://localhost", "keywords": null, "license": "LICENSE", "maintainer": null, "maintainer_email": null, "name": "classowl-client", "package_url": "https://pypi.org/project/classowl-client/", "platform": "UNKNOWN", "project_url": "https://pypi.org/project/classowl-client/", "project_urls": { "Download": "UNKNOWN", "Homepage": "http://localhost" }, "release_url": "https://pypi.org/project/classowl-client/0.1a2/", "requires_dist": null, "requires_python": null, "summary": "a client for the classowl.com REST API", "version": "0.1a2" }, "last_serial": 1131844, "releases": { "0.1a1": [ { "comment_text": "", "digests": { "md5": "1420942573b09deca5ea898dc6a7a152", "sha256": "88110f4d025d9d307c5edf0659a601f86080ff04b49d16c52ab11991ad655538" }, "downloads": -1, "filename": "classowl-client-0.1a1.tar.gz", "has_sig": false, "md5_digest": "1420942573b09deca5ea898dc6a7a152", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 4252, "upload_time": "2014-06-20T13:53:24", "url": "https://files.pythonhosted.org/packages/33/ba/cf235601efd1894e2c5a80834712b25e1f4006537c941c8a8736dc264fd5/classowl-client-0.1a1.tar.gz" } ], "0.1a2": [ { "comment_text": "", "digests": { "md5": "da46ea17ae46512a5563183a34138784", "sha256": "a3bc655aee51b4e6fb7bce12e995d265dbc2247afdfa68ffcc6bfeaf57d52ea0" }, "downloads": -1, "filename": "classowl-client-0.1a2.tar.gz", "has_sig": false, "md5_digest": "da46ea17ae46512a5563183a34138784", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 4243, "upload_time": "2014-06-20T14:12:29", "url": "https://files.pythonhosted.org/packages/6c/7b/1fa4a2b08c3d85ed5e9b87e7b0e2858757061621f4650d0672e0199a49d7/classowl-client-0.1a2.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "da46ea17ae46512a5563183a34138784", "sha256": "a3bc655aee51b4e6fb7bce12e995d265dbc2247afdfa68ffcc6bfeaf57d52ea0" }, "downloads": -1, "filename": "classowl-client-0.1a2.tar.gz", "has_sig": false, "md5_digest": "da46ea17ae46512a5563183a34138784", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 4243, "upload_time": "2014-06-20T14:12:29", "url": "https://files.pythonhosted.org/packages/6c/7b/1fa4a2b08c3d85ed5e9b87e7b0e2858757061621f4650d0672e0199a49d7/classowl-client-0.1a2.tar.gz" } ] }