Hi,
The code self.request.get('d') will actually return a unicode string
which will cause the InvalidURLError. You can convert the variable
domainName into a regular string by doing the following:
domainName = str(self.request.get('d'))
Also, for everyone's future reference, we have an article on how to
retrieve authenticated GData feeds with Google App Engine:
http://code.google.com/appengine/articles/gdata.html
I hope this helps.
Thanks,
--Tony
On Nov 5, 12:49 am, notbrain <[EMAIL PROTECTED]> wrote:
> Hey,
>
> I seem to be having the same problem as you, but I wasn't able to do
> string([[ whatever you pull from another variable ]]) to make it work.
>
> The code works if I used a literal 'domain.com' passed in as the
> domain name, but not as a GET argument in the URL assigned to a
> variable. If I use a variable set with self.request.get, I get the
> traceback pasted at the bottom of this message ending with:
> InvalidURLError: ApplicationError: 1. I'm relatively new to python,
> and have been investigating ways to escape the domainName variable,
> but haven't found anything that has helped (or I don't know what libs
> to import to support them). Escaping/decoding doesn't seem to help.
> What am I missing? Why does the literal string work, but the variable
> containing the same string doesn't? Thanks for any help!
>
> -----------------------------
> service = gdata.apps.service.AppsService()
> gdata.alt.appengine.run_on_appengine(service, store_tokens=True,
> single_user_mode=True)
>
> domainName = self.request.get('d')
> service.email = '[EMAIL PROTECTED]'
> # this doesn't work
> service.domain = domainName
> # this works
> # service.domain = 'example.com'
> service.password = 'pass'
>
> service.ProgrammaticLogin()
>
> UserFeedObject = service.RetrieveAllUsers()
> ---------------------
>
> Traceback (most recent call last):
> File "/Applications/GoogleAppEngineLauncher.app/Contents/Resources/
> GoogleAppEngine-default.bundle/Contents/Resources/google_appengine/
> google/appengine/ext/webapp/__init__.py", line 499, in __call__
> handler.get(*groups)
> File "/Users/notbrain/Projects/AppEngine/acronymtechdemo/main.py",
> line 44, in get
> UserFeedObject = service.RetrieveAllUsers()
> File "/Users/notbrain/Projects/AppEngine/acronmytechdemo/gdata/apps/
> service.py", line 381, in RetrieveAllUsers
> ret = self.RetrievePageOfUsers()
> File "/Users/notbrain/Projects/AppEngine/acronmytechdemo/gdata/apps/
> service.py", line 368, in RetrievePageOfUsers
> return gdata.apps.UserFeedFromString(str(self.Get(uri)))
> File "/Users/notbrain/Projects/AppEngine/acronmytechdemo/gdata/
> service.py", line 700, in Get
> headers=extra_headers)
> File "/Users/notbrain/Projects/AppEngine/acronmytechdemo/atom/
> service.py", line 176, in request
> data=data, headers=all_headers)
> File "/Users/notbrain/Projects/AppEngine/acronmytechdemo/gdata/
> auth.py", line 456, in perform_request
> return http_client.request(operation, url, data=data,
> headers=headers)
> File "/Users/notbrain/Projects/AppEngine/acronmytechdemo/gdata/alt/
> appengine.py", line 144, in request
> method=method, headers=all_headers, follow_redirects=False))
> File "/Applications/GoogleAppEngineLauncher.app/Contents/Resources/
> GoogleAppEngine-default.bundle/Contents/Resources/google_appengine/
> google/appengine/api/urlfetch.py", line 261, in fetch
> raise InvalidURLError(str(e))
> InvalidURLError: ApplicationError: 1
>
> Regards,
> Brian
>
> On Oct 16, 7:48 am, Met Sacramento <[EMAIL PROTECTED]> wrote:
>
> > I found my problem... sorry about not posting it.
>
> > It turns out that whatever you pass to the function I was using
> > (service.RetrieveUser()) had to be a string. I'm not proficient enough
> > in Python to know what I was actually passing it, but a simple
> > solution worked:
>
> > service.RetrieveUser(string([[ whatever you pull from another
> > variable ]]))
>
> > Worked like a charm... let me know if it works for you, too.
>
> > On Oct 15, 8:36 pm, Jose Ignacio Naranjo
>
> > <[EMAIL PROTECTED]> wrote:
> > > I am also having the same kind of problem, but with gcalendar API.
>
> > > In my case, the SDK tells me that the error is an invalid protocol.
> > > ERROR 2008-10-16 03:10:53,630 urlfetch_stub.py] Invalid protocol:
>
> > > Looking at the traceback I realized that the problem could be here:
> > > new_event = self.gcal.InsertEvent(event, '/calendar/feeds/' + id_cal +
> > > '/private/full')
> > > so, I changed the url of the calendar addding 'http://google.com/...'
>
> > > Then, the error became to this other one:
>
> > > File "/home/jor/google_apps/gbeep/core/gcalendar.py", line 53, in
> > > _InsertEvent
> > > new_event = self.gcal.InsertEvent(event, 'http://google.com/
> > > calendar/feeds/' + id_cal + '/private/full')
> > > File "/home/jor/google_apps/gbeep/gdata/calendar/service.py", line
> > > 149, in InsertEvent
> > > converter=gdata.calendar.CalendarEventEntryFromString)
> > > File "/home/jor/google_apps/gbeep/core/gdata/service.py", line 831,
> > > in Post
> > > media_source=media_source, converter=converter)
> > > File "/home/jor/google_apps/gbeep/core/gdata/service.py", line 951,
> > > in PostOrPut
> > > 'reason': server_response.reason, 'body': result_body}
> > > RequestError: {'status': 405, 'body': '...<H1>Method Not Allowed</H1>
> > > \nThe request method <code>POST</code> is inappropriate for the URL
> > > <code>/calendar/feeds/[EMAIL PROTECTED]/private/
> > > full</code>..., 'reason': ''}
>
> > > Creations usually are done by POSTs, and looking at the gcalendar code
> > > InsertEvent sends an (obvious) POST, so probably I have misunderstood
> > > something, cause the POST is ok! Well, surely I should rest some time,
> > > and try again :).
>
> > > Till yesterday, I used the default private calendar, and I hadn't any
> > > problem using the url '/calendar/feeds/private...' (no invalid
> > > protocol failure), the problem is happening from the change to use non-
> > > default calendars.
>
> > > Thanks for your help! :)
>
> > > On Sep 29, 7:12 pm, "Anirudh (Google)" <[EMAIL PROTECTED]> wrote:
>
> > > > Hi Sam,
>
> > > > I went through AppEngine URLFetch API code to figure out the error you
> > > > are
> > > > getting:http://code.google.com/p/googleappengine/source/browse/trunk/google/a...
>
> > > > It looks like the possible causes of the error is either an
> > > > unsupported protocol or a malformed URL.
> > > > Since URLFetch API allows https ( used by Provisioning API ),
> > > > malformed URL most likely is the possible
> > > > cause:http://code.google.com/appengine/docs/urlfetch/exceptions.html#Invali...
>
> > > > Is the error encountered both in AppEngine local SDK and live
> > > > deployment?
> > > > Also, to isolate the problem, can you please try fetching the admin
> > > > user itself that you used to create the service instance ?
>
> > > > -Anirudh
>
> > > > On Sep 29, 8:28 pm, Met Sacramento <[EMAIL PROTECTED]> wrote:
>
> > > > > Bump. I need some help here...
>
> > > > > On Sep 26, 3:25 pm, Met Sacramento <[EMAIL PROTECTED]> wrote:
>
> > > > > > Already did that.
>
> > > > > > I'm sending the right username - that's not the problem. I'm also
> > > > > > not
> > > > > > passing anything other than English letters in the URL.
>
> > > > > > Here's what I'm asking: What does "InvalidURLError:
> > > > > > ApplicationError:
> > > > > > 1" mean?
>
> > > > > > Sam
>
> > > > > > On Sep 26, 2:42 pm, "Patricia Goldweic" <[EMAIL PROTECTED]>
> > > > > > wrote:
>
> > > > > > > I suggest that you carefully debug your code, particularly by
> > > > > > > printing out
> > > > > > > the complete username string that you construct by grabbing the
> > > > > > > different
> > > > > > > pieces. Only then you can be sure that you're sending the right
> > > > > > > username to
> > > > > > > Google.
>
> > > > > > > -Patricia
>
> > > > > > > > -----Original Message-----
> > > > > > > > From: [email protected]
> > > > > > > > [mailto:[EMAIL PROTECTED] On Behalf Of Met Sacramento
> > > > > > > > Sent: Friday, September 26, 2008 12:39 PM
> > > > > > > > To: Google Apps APIs
> > > > > > > > Subject: [google-apps-apis] Problem with Provisioning API
>
> > > > > > > > Hey GAFYD Group...
>
> > > > > > > > I'm having some problems with the provisioning API. I'm
> > > > > > > > trying to retrieve a user by a username submitted via GET/POST.
>
> > > > > > > > When I explicitly pass the service.RetrieveUser() the
> > > > > > > > username, it works fine. When I pass it a variable (i.e.
> > > > > > > > self.request.get("username")... I'm using this on AppEngine),
> > > > > > > > it gives me the following stacktrace:
>
> > > > > > > > Traceback (most recent call last):
> > > > > > > > File "C:\Documents and Settings\setup\workspace\Google
> > > > > > > > AppEngine \google\appengine\ext\webapp\__init__.py", line
> > > > > > > > 496, in __call__
> > > > > > > > handler.get(*groups)
> > > > > > > > File "C:\Documents and
> > > > > > > > Settings\setup\workspace\PasswordReset\src
> > > > > > > > \resetpass.py", line 42, in get
> > > > > > > > self.response.out.write(service.RetrieveUser(username))
> > > > > > > > File "C:\Documents and
> > > > > > > > Settings\setup\workspace\PasswordReset\src
> > > > > > > > \gdata\apps\service.py", line 357, in RetrieveUser
> > > > > > > > return gdata.apps.UserEntryFromString(str(self.Get(uri)))
> > > > > > > > File "C:\Documents and
> > > > > > > > Settings\setup\workspace\PasswordReset\src
> > > > > > > > \gdata\service.py", line 665, in Get
> > > > > > > > headers=extra_headers)
> > > > > > > > File "C:\Documents and
> > > > > > > > Settings\setup\workspace\PasswordReset\src
> > > > > > > > \atom\service.py", line 163, in request
> > > > > > > > data=data, headers=all_headers)
> > > > > > > > File "C:\Documents and
> > > > > > > > Settings\setup\workspace\PasswordReset\src
> > > > > > > > \atom\http_interface.py", line 148, in perform_request
> > > > > > > > return http_client.request(operation, url, data=data,
> > > > > > > > headers=headers)
> > > > > > > > File "C:\Documents and
> > > > > > > > Settings\setup\workspace\PasswordReset\src
> > > > > > > > \gdata\alt\appengine.py", line 123, in request
> > > > > > > > method=method, headers=all_headers))
> > > > > > > > File "C:\Documents and Settings\setup\workspace\Google
> > > > > > > > AppEngine \google\appengine\api\urlfetch.py", line 257, in fetch
> > > > > > > > raise InvalidURLError(str(e))
> > > > > > > > InvalidURLError: ApplicationError: 1
>
> > > > > > > > What does this mean? Here is the code:
>
> > > > > > > > service =
>
> ...
>
> read more »
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Google Apps APIs" 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-apps-apis?hl=en
-~----------~----~----~----~------~----~------~--~---