Wiki

Clone wiki

illiad_newuser_creator / Home

Overview

This is a django app which provides a webservice that takes parameters, grabs user-credentials, authenticates user, and auto-registers the user in ILLiad.

Need met: we have a 'tunneler' as part of an 'easyBorrow' project that can take a request from worldcat.org and submit it to our ILLiad interlibrary-loan system. If the ILLiad tunneler detects that the user needs to be registered in ILLiad, this webservice is called.

Example usage

>>> import urllib, urllib2
>>> from django.utils import simplejson
>>> url = 'https://webservice_url'
>>> parameter_dict = {
...   'easyborrow_key': 'the_key',
...   'firstname': 'firstname', 
...   'lastname': 'lastname', 
...   'email': 'email', 
...   'phone': 'phone', 
...   'address': 'address', 
...   'patron_status': 'patron_status', 
...   'department': 'department' }
>>> parameter_string = urllib.urlencode( parameter_dict )
>>> request_object = urllib2.Request( url, parameter_string )
>>> response_object = urllib2.urlopen( request_object )
>>> json_dict = simplejson.loads( response_object.read() )
>>> json_dict
{u'status': u'success'}

# or... {u'status': u'failure', u'message': u'checkLoginResult message: user_already_registered'}
# or... {u'status': u'failure', u'message': u'checkLoginResult message: invalid_login'}

# or...
>>> request_object = urllib2.Request( url, parameter_string )
>>> try:
...   response_object = urllib2.urlopen( request_object )
... except Exception, e:
...   print e
HTTP Error 403: FORBIDDEN

Updated