Skip to main content

build-status-image

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.

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

If you're not sure about the file name format, learn more about wheel file names.

djangorestframework_yaml-0.1.0-py2.py3-none-any.whl (5.4 kB view details)

Uploaded Python 2Python 3

File details

Details for the file djangorestframework_yaml-0.1.0-py2.py3-none-any.whl.

File metadata

File hashes

Hashes for djangorestframework_yaml-0.1.0-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 dfcdc69aa75168d3334c7cec67e15156ae9104cf1b9ade3e4dd687f9662469cb
MD5 8e54a795e2a615185d65039abe062c74
BLAKE2b-256 be9543763132aaf2b376830cb48b19c720cdff2d3d5fae22d36ff6d0e433b5c3

See more details on using hashes here.

Release history Release notifications | RSS feed

2.0.0

2 files

1.0.3

2 files

1.0.2

2 files

1.0.1

2 files

1.0.0

2 files

This release

0.1.0 This release

1 file

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page