Using runserver or what deployment?
On Jan 11, 4:15 am, afrobeard <afrobe...@gmail.com> wrote:
> Hi,
>
> I was wondering if anyone has taken a look at Live Contacts API
> athttp://msdn.microsoft.com/en-us/library/bb463989.aspx
>
> I can get through step 1 i.e. Delegated Authentication. An exception
> is being raised when urllib2 calls the open function. The nature of
> the Error is 403 forbidden exception. Live Contacts API Errors are
> defined onhttp://msdn.microsoft.com/en-us/library/bb463952.aspx
>
> The only relevant post I could on any forum find related to this was:-
> 1.http://social.msdn.microsoft.com/Forums/en-US/wliddev/thread/06cdf66d...
>
> I'm really grateful for your help. Thanks. The code starts after this
> paragraph. WindowsLiveLogin.py itself is availible at Microsoft's
> download pagehttp://msdn.microsoft.com/en-us/library/cc287637.aspx
>
> def hotmail_importer_endpoint(request):
> from uni.site.profile.views import WindowsLiveLogin
>
> action = request.POST.get('action', None)
> wll.setDebug(True)
>
> if not action:
> #Show Form or Login Link
> url_text = wll.getConsentUrl("Contacts.Invite")
> return HttpResponse('''<html><body>
> <a href="%s">Click here to initiate authorization</a>
> </body></html>'''%url_text)
> else:
> fs = {}
> for post_var in request.POST:
> if post_var in request.POST:
> #fs[post_var].value should actually be equal to
> request.POST[post_var] as Microsoft implemented it. I just changed the
> code in WindowsLiveLogin.py to reflect this fast.
> fs[post_var] = request.POST[post_var]
> consent_token = wll.processConsent(fs)
> # The consent_token contains delt, reft, skey, exp, offer,
> lid
> # Delegation Token
> # Refresh Token
> # session key
> # offer
> # exp
> # lid
> token = consent_token
> to_signed_64 = lambda x: x < 2**63 and x or x - 2**64
> url = 'https://livecontacts.services.live.com/@c...@%s/REST/
> LiveContacts/Contacts' % to_signed_64(int(token.getLocationID(), 16))
> headers = {'Authorization': 'DelegatedToken dt="%s"' %
> urllib.unquote(token.getDelegationToken())}
> values = {}
> data = urllib.urlencode(values)
> req = urllib2.Request(url, data, headers)
> response = urllib2.build_opener().open(req)
> the_page = response.read()
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to
django-users+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---