Name | djapi JSON |
Version |
0.3
JSON |
| download |
home_page | https://github.com/Suor/djapi |
Summary | The library of simple helpers to build API with Django. |
upload_time | 2024-03-25 04:14:16 |
maintainer | None |
docs_url | None |
author | Alexander Schepanovski |
requires_python | None |
license | BSD |
keywords |
|
VCS |
|
bugtrack_url |
|
requirements |
No requirements were recorded.
|
Travis-CI |
No Travis.
|
coveralls test coverage |
No coveralls.
|
DjAPI
=====
The library of simple helpers to build API with Django.
Not aimed at implementing REST.
Requirements: Python 2.7-3.12+ and Django 2.1-5.0+. Installation::
$ pip install djapi
Setup
-----
Most of the library needs no configuration, but if you want to use token authentication:
.. code:: python
INSTALLED_APPS += ['djapi.authtoken']
DJAPI_AUTH = ['djapi.authtoken.use_token']
# Or add default django auth for e.g. debugging purposes
DJAPI_AUTH = ['djapi.authtoken.use_token', 'djapi.auth.use_contribauth']
Usage
-----
.. code:: python
import djapi as api
posts_qs = api.queryset(Post).filter(visible=True) \
.values_but('visible', 'modified_on') \
.values_add(category='category__title') \
.map_types(Image, lambda img: img.url)
@api.catch(Post.DoesNotExist, status=404)
def post(request, pk):
return api.json(posts_qs.get(pk=pk))
def posts_list(request):
return api.json(api.paginate(request, posts_qs, per_page=20))
@api.auth_required
@api.user_passes_test(lambda user: user.is_staff)
@api.validate(PostForm)
def posts_create(request, post):
post.created_by = request.user
post.save()
return api.json(201, created=post.pk)
posts = api.route(get=posts_list, post=posts_create)
Raw data
{
"_id": null,
"home_page": "https://github.com/Suor/djapi",
"name": "djapi",
"maintainer": null,
"docs_url": null,
"requires_python": null,
"maintainer_email": null,
"keywords": null,
"author": "Alexander Schepanovski",
"author_email": "suor.web@gmail.com",
"download_url": "https://files.pythonhosted.org/packages/0f/fa/883c786a2e1c5271d353a4dbca8b8c09ef34e678121aa88e6dfa51728784/djapi-0.3.tar.gz",
"platform": null,
"description": "DjAPI\n=====\n\nThe library of simple helpers to build API with Django.\nNot aimed at implementing REST.\n\nRequirements: Python 2.7-3.12+ and Django 2.1-5.0+. Installation::\n\n $ pip install djapi\n\n\nSetup\n-----\n\nMost of the library needs no configuration, but if you want to use token authentication:\n\n.. code:: python\n\n INSTALLED_APPS += ['djapi.authtoken']\n DJAPI_AUTH = ['djapi.authtoken.use_token']\n\n # Or add default django auth for e.g. debugging purposes\n DJAPI_AUTH = ['djapi.authtoken.use_token', 'djapi.auth.use_contribauth']\n\n\nUsage\n-----\n\n.. code:: python\n\n import djapi as api\n\n\n posts_qs = api.queryset(Post).filter(visible=True) \\\n .values_but('visible', 'modified_on') \\\n .values_add(category='category__title') \\\n .map_types(Image, lambda img: img.url)\n\n\n @api.catch(Post.DoesNotExist, status=404)\n def post(request, pk):\n return api.json(posts_qs.get(pk=pk))\n\n\n def posts_list(request):\n return api.json(api.paginate(request, posts_qs, per_page=20))\n\n @api.auth_required\n @api.user_passes_test(lambda user: user.is_staff)\n @api.validate(PostForm)\n def posts_create(request, post):\n post.created_by = request.user\n post.save()\n return api.json(201, created=post.pk)\n\n posts = api.route(get=posts_list, post=posts_create)\n",
"bugtrack_url": null,
"license": "BSD",
"summary": "The library of simple helpers to build API with Django.",
"version": "0.3",
"project_urls": {
"Homepage": "https://github.com/Suor/djapi"
},
"split_keywords": [],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "a68c98d22ce78904035b6c0ceaa0ad381d550bb9eeb6461e58baeca25a9df176",
"md5": "7cbe22ff86d83d6ee886258fa603bb50",
"sha256": "8c5f27e2d704c625a96db517a4cde9abd7cb2d49f0038f978354a37e586076ce"
},
"downloads": -1,
"filename": "djapi-0.3-py2.py3-none-any.whl",
"has_sig": false,
"md5_digest": "7cbe22ff86d83d6ee886258fa603bb50",
"packagetype": "bdist_wheel",
"python_version": "py2.py3",
"requires_python": null,
"size": 10483,
"upload_time": "2024-03-25T04:14:14",
"upload_time_iso_8601": "2024-03-25T04:14:14.783326Z",
"url": "https://files.pythonhosted.org/packages/a6/8c/98d22ce78904035b6c0ceaa0ad381d550bb9eeb6461e58baeca25a9df176/djapi-0.3-py2.py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "0ffa883c786a2e1c5271d353a4dbca8b8c09ef34e678121aa88e6dfa51728784",
"md5": "7cd4ab80877e9bb38ca71e0d88975e32",
"sha256": "c4b49d29981297df2b457d8a55345cc5bb376fce5500b4bbb41d14731f59c785"
},
"downloads": -1,
"filename": "djapi-0.3.tar.gz",
"has_sig": false,
"md5_digest": "7cd4ab80877e9bb38ca71e0d88975e32",
"packagetype": "sdist",
"python_version": "source",
"requires_python": null,
"size": 9347,
"upload_time": "2024-03-25T04:14:16",
"upload_time_iso_8601": "2024-03-25T04:14:16.774335Z",
"url": "https://files.pythonhosted.org/packages/0f/fa/883c786a2e1c5271d353a4dbca8b8c09ef34e678121aa88e6dfa51728784/djapi-0.3.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-03-25 04:14:16",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "Suor",
"github_project": "djapi",
"travis_ci": false,
"coveralls": false,
"github_actions": false,
"lcname": "djapi"
}