from xml.dom.minidom import parseString
from org.maemo.hermes.engine.phonenumber import PhoneNumber
from org.maemo.hermes.engine.friend import Friend
+from org.maemo.hermes.engine.service import CredentialsExpiredException
class LinkedInApi():
"""LinkedIn API for Hermes.
# look for errors
errors = dom.getElementsByTagName('error')
- if (errors and len(errors) > 0):
+ if errors and len(errors) > 0:
details = ""
try:
details = " (" + extract(errors[0], "message") + ")"
except:
pass
- raise Exception("LinkedIn communication errors detected" + details)
+ if details.startswith('([unauth'):
+ raise CredentialsExpiredException('linkedin')
+ else:
+ raise Exception("LinkedIn communication errors detected" + details)
friends = []
people = dom.getElementsByTagName('person')
be added to."""
pass
+
+
+# ---------------------------------------------------------------------------
+class CredentialsExpiredException(Exception):
+ """Used to indicate that the credentials provided, say via OAuth,
+ have expired or are incorrect.
+
+ Copyright (c) Andrew Flegg <andrew@bleb.org> 2010.
+ Released under the Artistic Licence."""
+
+
+ pass
\ No newline at end of file