{ "info": { "author": "David Karchmer", "author_email": "dkarchmer@gmail.com", "bugtrack_url": null, "classifiers": [ "Development Status :: 3 - Alpha", "License :: OSI Approved :: MIT License", "Operating System :: OS Independent", "Programming Language :: Python", "Topic :: Software Development :: Libraries :: Python Modules" ], "description": "# Strato Python API Package\n\nA python library for interacting with any Django web server base on django-rest-framework\n\nPackage is based on https://github.com/samgiles/slumber, but enhanced to support tokens and other features.\n\n## Features\n\n* Support for tokens. Both\n * django-rest-framework's own tokens: `rest_framework.authentication.TokenAuthentication`\n * JWT tokens: `rest_framework_jwt.authentication.JSONWebTokenAuthentication`\n\n* Support for arguments (e.g. `?name1=val1&name2=val2`)\n\n* Support for custom methods (e.g. ``/ap1/v1/object/custom/`)\n\n## Requirements\n\nrestframeworkclient requires the following modules.\n\n * Python 2.7+ or 3.4+\n * requests\n\n## Installation\n\n```\npip install drf_client\n```\n\n## Usage Guide\n\nExample\n\n```\noptions = {\n 'DOMAIN': 'http://127.0.0.1:8000',\n 'API_PREFIX': 'api/v1',\n 'TOKEN_TYPE': 'jwt',\n 'TOKEN_FORMAT': 'JWT {token}',\n 'LOGIN': 'auth/login/',\n 'LOGOUT': 'auth/logout/',\n}\n\nc = RestApi(options)\n\nok = c.login(email=email, password=password)\nif ok:\n\n # GET some data\n my_object = c.myresourcename.get()\n for obj in my_object['results']:\n pprint(obj)\n logger.info('------------------------------')\n\n payload = {\n 'data1': 'val1',\n 'data2': 'val2',\n }\n\n resp = c.myresourcename.post(data=payload)\n\n```\n\n\n## Django Setup\n\nClient assumes by default that all urls should end with a slash (tested with the default\nrouter: `routers.DefaultRouter()`)\n\nApart from the regular Django and Rest Framework setup, this package currently relies on the following custom\nlogin and logout API functions:\n\n```\nclass AccountSerializer(serializers.ModelSerializer):\n class Meta:\n model = User\n fields = ('id', 'email', 'username')\n\n\nclass APILogoutViewSet(APIView):\n permission_classes = (permissions.IsAuthenticated,)\n\n def post(self, request, format=None):\n logout(request)\n return Response({}, status=status.HTTP_204_NO_CONTENT)\n\n\nurlpatterns = [\n url(r'^auth/logout/$', APILogoutViewSet.as_view(), name='api-logout'),\n\n```\n\n## Development\n\nTo test, run python setup.py test or to run coverage analysis:\n\n```\ncoverage run --source=iotile_cloud setup.py test\ncoverage report -m\n```\n\nYou can also use py.test:\n\n```\npy.test\n```\n", "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/dkarchmer/django-rest-framework-client", "keywords": "django,djangorestframework,Rest", "license": "MIT", "maintainer": null, "maintainer_email": null, "name": "django-rest-framework-client", "package_url": "https://pypi.org/project/django-rest-framework-client/", "platform": "UNKNOWN", "project_url": "https://pypi.org/project/django-rest-framework-client/", "project_urls": { "Download": "UNKNOWN", "Homepage": "https://github.com/dkarchmer/django-rest-framework-client" }, "release_url": "https://pypi.org/project/django-rest-framework-client/0.1.1/", "requires_dist": null, "requires_python": null, "summary": "Python client for a DjangoRestFramework based web site", "version": "0.1.1" }, "last_serial": 2857552, "releases": { "0.1.0": [ { "comment_text": "", "digests": { "md5": "abbd17f1e25064ceccd5be4a18ad7322", "sha256": "69b2f6e328bb1013fb29b1277677ca946354f5eb06e9cb1a796761b4ad2f37ff" }, "downloads": -1, "filename": "django-rest-framework-client-0.1.0.tar.gz", "has_sig": false, "md5_digest": "abbd17f1e25064ceccd5be4a18ad7322", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 5944, "upload_time": "2017-05-07T18:53:23", "url": "https://files.pythonhosted.org/packages/dd/21/85f060da294856900ce190f7621107ce76d0f47cd0c3a52652f3eec4640d/django-rest-framework-client-0.1.0.tar.gz" } ], "0.1.1": [ { "comment_text": "", "digests": { "md5": "b4d21dfb7389313d02c630b72c63be5f", "sha256": "87bd928750fc06d61bf8e34fc24d82406ed5bf1fda0d9290e8e6ac7e222c5f25" }, "downloads": -1, "filename": "django-rest-framework-client-0.1.1.tar.gz", "has_sig": false, "md5_digest": "b4d21dfb7389313d02c630b72c63be5f", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 5934, "upload_time": "2017-05-07T19:00:58", "url": "https://files.pythonhosted.org/packages/d0/aa/f3e871213c43c4750cf9cdec8f5c2e90217c6018294f89571d1046067753/django-rest-framework-client-0.1.1.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "b4d21dfb7389313d02c630b72c63be5f", "sha256": "87bd928750fc06d61bf8e34fc24d82406ed5bf1fda0d9290e8e6ac7e222c5f25" }, "downloads": -1, "filename": "django-rest-framework-client-0.1.1.tar.gz", "has_sig": false, "md5_digest": "b4d21dfb7389313d02c630b72c63be5f", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 5934, "upload_time": "2017-05-07T19:00:58", "url": "https://files.pythonhosted.org/packages/d0/aa/f3e871213c43c4750cf9cdec8f5c2e90217c6018294f89571d1046067753/django-rest-framework-client-0.1.1.tar.gz" } ] }