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!

Generic application to handle Remote Data API calls

Project Description

Generic application to handle Remote Data API calls


For each specific tasks a handler function must be implemented.


pip install djabberd

Quick start

1. Include the django-ejabberd URLconf in your project like this::

url(r'', include('djabberd.urls'),
# For Django==1.8
url(r'', include('djabberd.urls'), namespace='djabberd')

2. Setup the handler in your Django settings::


Based on ejabberd-saas’s documentation those endpoints are required(01-Feb-2016):

  1. User management:
    1. Authentication (‘/auth’)
    2. User exists (‘/user’)
  2. Roster management:
    1. Retrieve user roster (‘/roster’)
  3. Archive:
    1. Store (‘/archive’)
    2. Get (‘/archive’)

There must be one function for each endpoint that should be implemented like this:

  • user_authentication(username, password):
    • Returns True if authentication is valid
    • Returns False if authentication is not valid
  • user_exists(username):
    • Returns True if user exists
    • Returns False if not(or if it is not active)
  • retrieve_user_roster(username):
    • Returns the roster in JSON format
    • Returns False if user does not exist
  • archive_store(payload)
    • Returns True if message has been stored
    • Returns a string containing an error message if message has not been stored
  • archive_get(username[, peer, after, before, limit, chat_type])
    • Returns the message history in JSON format
    • Returns False in any other case


  • retrieve_user_roster:

    {"roster": [
        {"username": "CONTACT",
         "subscription": "both",
         "nick": "NICK"},
  • archive_store:

    {"username": "USERNAME1",
     "peer": "USERNAME2",
     "xml": "MESSAGE_STANZA",
     "body": "TEXT",
     "timestamp": "TIMESTAMP",
     "direction": "DIRECTION"}
  • archive_get:

    {"archive": [{"username": "USERNAME1",
                  "peer": "USERNAME2",
                  "xml": "MESAGE_STANZA",
                  "body": "TEXT",
                  "timestamp": "TIMESTAMP",
                  "direction": "DIRECTION"}, ...]
                  "count" : MESSAGES_NUMBER


Based on ejabberd-saas’s documentation:

  • If XMPP JID is “userid@xmppdomain”, just pass “userid”
  • If XMPP JID of USER is “userid@xmppdomain”, just pass “xmppdomain”
  • If an exception is raised from your handler it would be treated as a server error
  • Return HTTP 200 for the successful case
  • Return HTTP 401 if authentication fails
  • Return HTTP 401 if it’s not the successful case
  • Return HTTP 500 for server errors, this is the Django’s default behavior

Running Tests

python develop
python [tests.<tests_module>[.<TestClass>[.<test_method>]]]

Release History

This version
History Node


History Node


History Node


History Node


History Node


Download Files

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

Filename, Size & Hash SHA256 Hash Help File Type Python Version Upload Date
(21.9 kB) Copy SHA256 Hash SHA256
Wheel py2.py3 Feb 16, 2018
(5.6 kB) Copy SHA256 Hash SHA256
Source None Feb 16, 2018

Supported By

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 Google Google Cloud Servers DreamHost DreamHost Log Hosting