Skip to main content
This is a pre-production deployment of Warehouse. Changes made here affect the production instance of PyPI (
Help us improve Python packaging - Donate today!

XML backed models queried from external REST apis

Project Description
[![Build Status](](
[![Coverage Status](](

[Read The Docs](

# XmlModels2

XmlModels allows you to define Models similar in nature to Django models that are backed by XML endpoints rather than a
database. Using a familiar declarative definition, the fields map to values in the XML document by means of XPath
expressions. With support for querying external REST APIs using a django-esque approach, we have strived to make
writing and using xml backed models as close to django database models as we can, within the limitations of the
available API calls.

# Installation

The simplest approach is to to use `pip install xml_models2`

# A simple example

Just to get started, this is an example of taking an XML representation of an Address that might be returned from a
GET request to an external REST api.

<Address id="2">
<street>Acacia Avenue</street>
<postcode>IM6 66B</postcode>

class Address(xml_models.Model):
number = xml_models.IntField(xpath="/Address/number")
street = xml_models.CharField(xpath="/Address/street")
city = xml_models.CharField(xpath="/Address/city")
country = xml_models.CharField(xpath="/Address/country")
postcode = xml_models.CharField(xpath="/Address/postcode")

finders = {(id,): 'http://adresses/%s'}

This example would be used as follows:-

>>> address = Address.objects.get(id=2)
>>> print "address is %s, %s" % (address.number, address.street)
"22, Acacia Avenue"

# Heritage

This project is a fork of [Django REST Models](
Release History

Release History

This version
History Node


History Node


History Node


History Node


History Node


History Node


History Node


History Node


History Node


Download Files

Download Files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

File Name & Checksum SHA256 Checksum Help Version File Type Upload Date
xml_models2-0.11.1-py2.py3-none-any.whl (13.1 kB) Copy SHA256 Checksum SHA256 2.7 Wheel Oct 30, 2015 (13.5 kB) Copy SHA256 Checksum SHA256 Source Oct 30, 2015

Supported By

WebFaction WebFaction Technical Writing Elastic Elastic Search Pingdom Pingdom Monitoring Dyn Dyn DNS Sentry Sentry Error Logging CloudAMQP CloudAMQP RabbitMQ Heroku Heroku PaaS Kabu Creative Kabu Creative UX & Design Fastly Fastly CDN DigiCert DigiCert EV Certificate Rackspace Rackspace Cloud Servers DreamHost DreamHost Log Hosting