can anybody tell me how to write a script to import hotmail contacts
with windowslivelogin.py library,i have a web based script used for
django environment brlow:
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()
How this can be achieved in python console script with delauth-python
1.2 lib but no djago environment?
thanx in advance
--
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.