YAML support for Django REST Framework
Project description
Overview
YAML support extracted as a third party package directly from the official Django REST Framework implementation. It’s built using the PyYAML package.
Requirements
Python (2.7, 3.3, 3.4)
Django (1.6, 1.7)
Installation
Install using pip…
$ pip install djangorestframework-yaml
Example
REST_FRAMEWORK = {
'DEFAULT_PARSER_CLASSES': (
'rest_framework_yaml.parsers.YAMLParser',
),
'DEFAULT_RENDERER_CLASSES': (
'rest_framework_yaml.renderers.YAMLRenderer',
),
}
You can also set the renderer and parser used for an individual view, or viewset, using the APIView class based views.
from rest_framework.response import Response
from rest_framework.views import APIView
from rest_framework_yaml.parsers import YAMLParser
from rest_framework_yaml.renderers import YAMLRenderer
class ExampleView(APIView):
"""
A view that can accept POST requests with YAML content.
"""
parser_classes = (YAMLParser,)
renderer_classes = (YAMLRenderer,)
def post(self, request, format=None):
return Response({'received data': request.DATA})
Documentation & Support
Full documentation for the project is available at http://jpadilla.github.io/django-rest-framework-yaml/.
You may also want to follow the author on Twitter.
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distributions
No source distribution files available for this release.See tutorial on generating distribution archives.
Built Distribution
File details
Details for the file djangorestframework_yaml-0.1.0-py2.py3-none-any.whl
.
File metadata
- Download URL: djangorestframework_yaml-0.1.0-py2.py3-none-any.whl
- Upload date:
- Size: 5.4 kB
- Tags: Python 2, Python 3
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | dfcdc69aa75168d3334c7cec67e15156ae9104cf1b9ade3e4dd687f9662469cb |
|
MD5 | 8e54a795e2a615185d65039abe062c74 |
|
BLAKE2b-256 | be9543763132aaf2b376830cb48b19c720cdff2d3d5fae22d36ff6d0e433b5c3 |