i have the SDK with me,
source code for getting hotmail contacts in DJANGO environment:
----------------------------------------------------------------------------------
from lib.WindowsLiveLogin import ConsentToken
import urllib, urllib2
def hotmail_login(request):
wll =
WindowsLiveLogin(appid=settings.WINDOWS_APPID,secret=settings.WINDOWS_SECRET,policyurl='<put
your policy url here, it wont work without it!>')
url = wll.getConsentUrl("Contacts.View")
return redirect(url)
def hotmail_callback(request):
wll =
WindowsLiveLogin(appid=settings.WINDOWS_APPID,secret=settings.WINDOWS_SECRET,
policyurl='<policy url again>')
class Obj(object):
pass
fs = {}
for var in request.POST:
fs[var] = Obj()
fs[var].value = request.POST.get(var)
consent_token = wll.processConsent(fs)
if consent_token and consent_token.isValid():
lid = consent_token.getLocationID()
lid16 = int(lid, 16)
to_signed_64 = lambda x: x < 2**63 and x or x - 2**64
lid_s64 = to_signed_64(lid16)
url = 'https://livecontacts.services.live.com/users/@c...@%s/rest/
invitationsbyemail' % lid_s64
req = urllib2.Request(url)
req.add_header('Authorization', 'DelegatedToken dt="%s"'
%urllib.unquote(consent_token.getDelegationToken()))
response = urllib2.build_opener().open(req)
the_page = response.read()
when i am trying to run the above script in the lib path ,shows error:
from lib.WindowsLiveLogin import ConsentToken
ImportError: No module named lib.WindowsLiveLogin
Also i need a console script without django framework,can anybody tell
me on what should i modify on the above script.........
--
You received this message because you are subscribed to the Google Groups
"Django users" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/django-users?hl=en.