On Jun 20, 2008, at 5:22 PM, Peter wrote:

> I'm trying to use ruby to access my private calendar feed by adapting
> Jochen Hartmenn's ruby code for interacting with the google
> spreadsheets api:
>
> http://code.google.com/support/bin/answer.py?answer=93164&topic=12027
>
> Using his get_feed method, I get a "302 Redirect" response when I try
> to access my calendar's private feed. The following article suggests
> that I just need to keep track of the given gsessionid and use it as a
> parameter in subsequent requests:
>
> http://code.google.com/support/bin/answer.py?answer=55833&topic=10360
>
> However, when I use the response's url with a gsessionid for a
> subsequent request, I receive another 302 response redirecting me to a
> url with a different gsessionid. Why am I being assigned a new
> gsessionid?
>
> My code is pasted here: http://pastie.org/219266. Any ideas would be
> greatly appreciated.

I had the same problem. It appears that the Spreadsheets API doesn't  
have to follow redirects.

The problem with your code is this line:

32     return http.get(uri.path, headers)

The path of a redirect uri like:

http://www.google.com/calendar/feeds/[EMAIL 
PROTECTED]/private/full?gsessionid=VnmlJoi6X3KlBwvdzqSMlQ

is /calendar/feeds/[EMAIL PROTECTED]/private/full

You want to replace uri.path with uri.request_uri

One other hint: you don't need to scrape the redirect location out of  
the returned html, it is immediately available in the response hash as  
my_calendar['location'].


-- 

Ray

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Google Calendar Data API" 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/google-calendar-help-dataapi?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to