I’m learning Django 1.7 lately and nothing better than practice and create something from scratch. I have a bunch of scripts to tests webservices(XML, soap, etc.) in python using requests library, it works well so far. It returns the time it spent running, the result in an XML format and based on these data I make decisions(send email, feed it to a monitoring tool, etc.). When it’s 1 or 2 scripts is easy to admin and make changes like the XML request, headers and so on. And finally I found some time to focus more on Django and setup a web interface to do these tasks.

I’m using boostrap, Django 1.7 and Python 2.7. Think this as a simple SoapUI on web.

The main idea is to put all these objects(headers, URLs, arguments, XML requests) inside a task and run it. Below a image to you get the idea:

The repository is on github: https://github.com/bicofino/Pyramboia

Lets install the application and run a simple task. Keep in mind that I’m using Ubuntu and sqlite as the database.

Install virtualenv and clone the repository

vagrant@zato-vagrant:~$ virtualenv ~/.envs/Pyramboia
New python executable in /home/vagrant/.envs/Pyramboia/bin/python
Installing setuptools, pip...done.

vagrant@zato-vagrant:~$ source ~/.envs/Pyramboia/bin/activate

(Pyramboia)vagrant@zato-vagrant:~$ git clone https://github.com/bicofino/Pyramboia.git
Cloning into 'Pyramboia'...
remote: Counting objects: 143, done.
remote: Compressing objects: 100% (17/17), done.
Receiving objects: 100% (143/143), 828.32 KiB | 350.00 KiB/s, done.
remote: Total 143 (delta 6), reused 0 (delta 0)
Resolving deltas: 100% (38/38), done.
Checking connectivity... done.

Install Pyramboia requirements

(Pyramboia)vagrant@zato-vagrant:~/Pyramboia/pyramboia$ ls
manage.py  pyramboia  static  tasks
(Pyramboia)vagrant@zato-vagrant:~/Pyramboia$ ls
CHANGELOG  LICENSE.txt  README.md  docs  pyramboia  requirements

Before you start, install the packages below you are going need for lxml:

sudo apt-get install -y libxml2-dev libxslt-dev python-dev lib32z1-dev

Next step install Pyramboia requirements

(Pyramboia)vagrant@zato-vagrant:~/Pyramboia$ pip install -r requirements/base.txt 
Downloading/unpacking Django==1.7 (from -r requirements/base.txt (line 1))
  Downloading Django-1.7-py2.py3-none-any.whl (7.4MB): 7.4MB downloaded
Requirement already satisfied (use --upgrade to upgrade): argparse==1.2.1 in /usr/lib/python2.7 (from -r requirements/base.txt (line 2))
Downloading/unpacking certifi==14.05.14 (from -r requirements/base.txt (line 3))
  Downloading certifi-14.05.14.tar.gz (168kB): 168kB downloaded
  Running setup.py (path:/home/vagrant/.envs/Pyramboia/build/certifi/setup.py) egg_info for package certifi
Downloading/unpacking django-crispy-forms==1.4.0 (from -r requirements/base.txt (line 4))
  Downloading django-crispy-forms-1.4.0.tar.gz (47kB): 47kB downloaded
  Running setup.py (path:/home/vagrant/.envs/Pyramboia/build/django-crispy-forms/setup.py) egg_info for package django-crispy-forms
    warning: no files found matching '*' under directory 'crispy_forms/static'
Downloading/unpacking django-json-rpc==0.6.1 (from -r requirements/base.txt (line 5))
  Downloading django-json-rpc-0.6.1.tar.gz (101kB): 101kB downloaded
  Running setup.py (path:/home/vagrant/.envs/Pyramboia/build/django-json-rpc/setup.py) egg_info for package django-json-rpc
Downloading/unpacking django-tables2==0.15.0 (from -r requirements/base.txt (line 6))
  Downloading django-tables2-0.15.0.tar.gz (43kB): 43kB downloaded
  Running setup.py (path:/home/vagrant/.envs/Pyramboia/build/django-tables2/setup.py) egg_info for package django-tables2
Downloading/unpacking lxml==3.3.6 (from -r requirements/base.txt (line 7))
  Downloading lxml-3.3.6.tar.gz (3.5MB): 3.5MB downloaded
  Running setup.py (path:/home/vagrant/.envs/Pyramboia/build/lxml/setup.py) egg_info for package lxml
    /usr/lib/python2.7/distutils/dist.py:267: UserWarning: Unknown distribution option: 'bugtrack_url'
    Building lxml version 3.3.6.
    Building without Cython.
    Using build configuration of libxslt 1.1.28
    warning: no previously-included files found matching '*.py'
Downloading/unpacking requests==2.4.0 (from -r requirements/base.txt (line 8))
  Downloading requests-2.4.0-py2.py3-none-any.whl (457kB): 457kB downloaded
Downloading/unpacking six==1.7.3 (from -r requirements/base.txt (line 9))
  Downloading six-1.7.3-py2.py3-none-any.whl
Requirement already satisfied (use --upgrade to upgrade): wsgiref==0.1.2 in /usr/lib/python2.7 (from -r requirements/base.txt (line 10))
Installing collected packages: Django, certifi, django-crispy-forms, django-json-rpc, django-tables2, lxml, requests, six
  Running setup.py install for certifi
  Running setup.py install for django-crispy-forms
    warning: no files found matching '*' under directory 'crispy_forms/static'
  Running setup.py install for django-json-rpc
  Running setup.py install for django-tables2
  Running setup.py install for lxml
    /usr/lib/python2.7/distutils/dist.py:267: UserWarning: Unknown distribution option: 'bugtrack_url'
    Building lxml version 3.3.6.
    Building without Cython.
    Using build configuration of libxslt 1.1.28
    building 'lxml.etree' extension
    x86_64-linux-gnu-gcc -pthread -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fPIC -I/usr/include/libxml2 -I/home/vagrant/.envs/Pyramboia/build/lxml/src/lxml/includes -I/usr/include/python2.7 -c src/lxml/lxml.etree.c -o build/temp.linux-x86_64-2.7/src/lxml/lxml.etree.o -w
    x86_64-linux-gnu-gcc -pthread -shared -Wl,-O1 -Wl,-Bsymbolic-functions -Wl,-Bsymbolic-functions -Wl,-z,relro -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -D_FORTIFY_SOURCE=2 -g -fstack-protector --param=ssp-buffer-size=4 -Wformat -Werror=format-security build/temp.linux-x86_64-2.7/src/lxml/lxml.etree.o -lxslt -lexslt -lxml2 -lz -lm -o build/lib.linux-x86_64-2.7/lxml/etree.so
    building 'lxml.objectify' extension
    x86_64-linux-gnu-gcc -pthread -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fPIC -I/usr/include/libxml2 -I/home/vagrant/.envs/Pyramboia/build/lxml/src/lxml/includes -I/usr/include/python2.7 -c src/lxml/lxml.objectify.c -o build/temp.linux-x86_64-2.7/src/lxml/lxml.objectify.o -w
    x86_64-linux-gnu-gcc -pthread -shared -Wl,-O1 -Wl,-Bsymbolic-functions -Wl,-Bsymbolic-functions -Wl,-z,relro -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -D_FORTIFY_SOURCE=2 -g -fstack-protector --param=ssp-buffer-size=4 -Wformat -Werror=format-security build/temp.linux-x86_64-2.7/src/lxml/lxml.objectify.o -lxslt -lexslt -lxml2 -lz -lm -o build/lib.linux-x86_64-2.7/lxml/objectify.so
Successfully installed Django certifi django-crispy-forms django-json-rpc django-tables2 lxml requests six
Cleaning up...

Run migrate command

(Pyramboia)vagrant@zato-vagrant:~/Pyramboia/pyramboia$ python manage.py migrate
Operations to perform:
  Synchronize unmigrated apps: django_tables2, crispy_forms
  Apply all migrations: admin, contenttypes, tasks, auth, sessions
Synchronizing apps without migrations:
  Creating tables...
  Installing custom SQL...
  Installing indexes...
Running migrations:
  Applying contenttypes.0001_initial... OK
  Applying auth.0001_initial... OK
  Applying admin.0001_initial... OK
  Applying sessions.0001_initial... OK
  Applying tasks.0001_initial... OK
  Applying tasks.0002_auto_20140902_2214... OK
  Applying tasks.0003_auto_20140905_1806... OK
(Pyramboia)vagrant@zato-vagrant:~/Pyramboia/pyramboia$ ls
manage.py  pyramboia  static  tasks

Run the application

(Pyramboia)vagrant@zato-vagrant:~/Pyramboia/pyramboia$ ./manage.py runserver
Performing system checks...

System check identified no issues (0 silenced).
September 29, 2014 - 14:43:51
Django version 1.7, using settings 'pyramboia.settings.local'
Starting development server at
Quit the server with CONTROL-C.

First page

Create a new project

First we need to create a new project since all tasks are attached to a Project

Add the target(URL)

We are going use this webservice http://wsf.cdyne.com/WeatherWS/Weather.asmx to get information about the weather.

Configure the headers

Our SOAPAction http://ws.cdyne.com/WeatherWS/GetCityForecastByZIP

Create the task

Finally lets create the task and run it:

Our XML request:

<soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
    <GetCityForecastByZIP xmlns="http://ws.cdyne.com/WeatherWS/">

The application is easy and really simple. I plan to add new features in the future and I hope you find it you useful. If you have any question or feedback, feel free to comment or send an issue over github.