开发者

Error:Cannot access the calendar you requested

开发者 https://www.devze.com 2023-03-28 10:31 出处:网络
When I post my events\'xml file to google\'s server , sometimes I will receive the html below , I am very confused why it happens ,but sometimes it is OK. Any one can help me?

When I post my events' xml file to google's server , sometimes I will receive the html below , I am very confused why it happens ,but sometimes it is OK. Any one can help me?

Is it caused by the connection error? or the token is invalid ? or what?

<html><head><meta http-equiv="content-type" content="text/html;charset=UTF-8">
<title>Error</title>
<style type="text/css">body {font-family: arial,sans-serif}</style></head>
<body text="#000000" bgcolor="#ffffff"><table border="0" cellpadding="2" cellspacing="0" width="100%"><tr><td rowspan="3" width="1%" nowrap><b><font face="times" size="10"><font color="#0039b6">G</font> <font color="#c41200">o</font> <font color="#f3c518">o</font> <font color="#0039b6">g</font> <font color="#30a72f">l</font> <font color="#c41200">e</font></font>&nbsp;&nbsp;</b></td>
<td>&nbsp;</td></tr>
<tr><td bgcolor="#3366cc"><font face="arial,sans-serif" color="#ffffff"><b>Error</b></font></td></tr>
<tr><td>&a开发者_C百科mp;nbsp;</td></tr></table>
<blockquote>Cannot access the calendar you requested</blockquote>
<p></p>
<div style="background:#3366cc; width:1px; height:4px"></div></body></html>


Well, I can't say I really like the answer to this question, but I was having the same issue and found an answer after a bit of finagling.

Google has its own session ID that it uses for these kinds of requests. The first time you make a request, it starts the session and gives you a redirect; it also causes the error you saw above. From what I can gather, if you try the request again after the session ID has been set, the request will go through.

In other words, you have to send the request and check the response from Google to see if you're being redirected. If you are, you have a couple of options to grab the URL that has Google's session ID (gsessionid) included; I chose to parse the Location header out of the response, which shows the URL to which the data should be posted. Try your request again (and any subsequent requests) by posting to that new URL, and it should work like a charm. Just takes a bit to get there.

For more info about this, check the Google documentation on redirects and this somewhat related StackOverflow question.

0

精彩评论

暂无评论...
验证码 换一张
取 消