Skip to main content

build-status-image

Overview

XML support extracted as a third party package directly from the official Django REST Framework implementation. It’s built using the defusedxml package.

Requirements

  • Python (2.7, 3.3, 3.4)

  • Django (1.6, 1.7)

  • Django REST Framework (2.4.3, 2.4.4, 3.0-beta)

Installation

Install using pip

$ pip install djangorestframework-xml

Example

REST_FRAMEWORK = {
    'DEFAULT_PARSER_CLASSES': (
        'rest_framework_xml.parsers.XMLParser',
    ),
    'DEFAULT_RENDERER_CLASSES': (
        'rest_framework_xml.renderers.XMLRenderer',
    ),
}

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_xml.parsers import XMLParser
from rest_framework_xml.renderers import XMLRenderer

class ExampleView(APIView):
    """
    A view that can accept POST requests with XML content.
    """
    parser_classes = (XMLParser,)
    renderer_classes = (XMLRenderer,)

    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-xml/.

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 Distribution

djangorestframework-xml-0.1.0.tar.gz (3.6 kB view details)

Uploaded Source

Built Distribution

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

djangorestframework_xml-0.1.0-py2.py3-none-any.whl (4.8 kB view details)

Uploaded Python 2Python 3

File details

Details for the file djangorestframework-xml-0.1.0.tar.gz.

File metadata

File hashes

Hashes for djangorestframework-xml-0.1.0.tar.gz
Algorithm Hash digest
SHA256 120d9201e8b3bf7947237698b7b596aa2208ad65f03fd6d152c913a82c13c9dc
MD5 ecb52aa0176a0c4151be89db48e5ee33
BLAKE2b-256 e950f3bd9a1a38883e874ccdd7890f295e3329ba0acdd9a9aa37a9159ae87e93

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for djangorestframework_xml-0.1.0-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 dcab478819248bc9e96958d4d166a3147a52b9293d82c45b36339f7899a6b710
MD5 4900246b5aae088492c7c00ee754a572
BLAKE2b-256 2ef4280b84f6e6d1ed81e8fd9824dd36c3f320e583b651e1b2aa0340b3f87642

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page