Hi Neal,
Some standard errors come to all of the Data APIs are listed here:
http://code.google.com/apis/gdata/docs/2.0/reference.html#HTTPStatusCodes

<http://code.google.com/apis/gdata/docs/2.0/reference.html#HTTPStatusCodes>Of
course, each API may have slightly different errors specific
to that service.  In general, you can follow the above list, but I wouldn't
recommend displaying the error message directly.  For example,
you can assume a 401 is related to an authentication issue.
In your example, it's b/c the user doesn't have access to that
document.

Eric

On Tue, Aug 4, 2009 at 6:17 PM, NealWalters <nealwalt...@nealwalters.com>wrote:

>
>
> I purposely caused this error by removing a user from the document,
> and trying to get it's feed by docid:
>
> {'status': 401L, 'body': 'Sorry, that action is not allowed',
> 'reason': ''}
>
> I'm looking for where these erros are documented.  The reason above
> seems to be blank, this is not an error that a user would understand,
> so I'm tasked with interpreting the errors for the user.
>
> Is there a page in the doc that says what a 401L is, and what other
> errors I might possibly get?
>
> I'm running under GAE, here's my code.  I've got a timeout once or
> twice, so I'm trying to retry for timeouts, but give a more friendly
> message for other type of errors.
>
>
> def GetGoogleDocHTMLContents(argClient, argDocId):
>   """
>   Given a docId, and an already authorized client,
>   grab the HTML contents of a file on google docs
>   """
>   exportFormat = "html"
>   domain = "docs.google.com"
>   url = "http://"; + domain + "/feeds/download/documents/Export?
> docID=" + argDocId + "&exportFormat=" + exportFormat
>
>   #TODO - how to test this - also might want retry on other feeds and
> client.login
>   retries = 0
>   htmlFileContents = ""
>   err = "time"  #short for timeout
>   while retries < 5 and "time" in err.lower():
>      try:
>         htmlFileContents = argClient.Get(url,converter=str)
>         retries = 9999 #we got the file, quit the loop
>      except (Exception), err:
>         #TODO specifically look for timeout here, not just any error
>         retries += 1
>         htmlFileContents = str(err)
>         import logging
>         logging.debug("GetGoogleDocHTMLContents:" + str(err))
>
>   return htmlFileContents
>
>
> Thanks,
> Neal Walters
>
>
> >
>

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Google Docs Data APIs" group.
To post to this group, send email to Google-Docs-Data-APIs@googlegroups.com
To unsubscribe from this group, send email to 
google-docs-data-apis+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/Google-Docs-Data-APIs?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to