[open-ils-commits] r1212 - servres/trunk/conifer/integration (artunit)
svn at svn.open-ils.org
svn at svn.open-ils.org
Fri Jan 28 00:13:48 EST 2011
Author: artunit
Date: 2011-01-28 00:13:45 -0500 (Fri, 28 Jan 2011)
New Revision: 1212
Modified:
servres/trunk/conifer/integration/uwindsor.py
Log:
auth token function added
Modified: servres/trunk/conifer/integration/uwindsor.py
===================================================================
--- servres/trunk/conifer/integration/uwindsor.py 2011-01-28 03:21:29 UTC (rev 1211)
+++ servres/trunk/conifer/integration/uwindsor.py 2011-01-28 05:13:45 UTC (rev 1212)
@@ -11,6 +11,7 @@
from xml.etree import ElementTree as ET
import csv
import datetime
+import hashlib
import time
import os
import re
@@ -204,6 +205,26 @@
pass # fail silently in production if there's an opensrf or time related error.
return None
+#for example: auth_token("username at uwindsor.ca", "password", "OWA", "workstation")
+def auth_token(username, password, org, workstation):
+ try:
+ authtoken = None
+ payload = E1('open-ils.auth.authenticate.init', username)
+ pw = hashlib.md5(password).hexdigest()
+ pw = hashlib.md5(payload + pw).hexdigest()
+ authinfo = E1('open-ils.auth.authenticate.complete',{"password":pw, "type":"staff",
+ "org": org, "username":username,
+ "workstation":workstation})
+ if authinfo:
+ payload = authinfo.get("payload")
+ authtoken = payload.get("authtoken")
+ except:
+ print "authentication problem: ", username
+ print "*** print_exc:"
+ traceback.print_exc()
+ pass # fail silently in production
+ return authtoken
+
def cat_search(query, start=1, limit=10):
bibid=0
bc = re.search('\d{14}', query.strip())
More information about the open-ils-commits
mailing list