Change the user agent of URL Fetch API

2,835 views
Skip to first unread message

Marc D

unread,
May 9, 2008, 3:31:22 AM5/9/08
to Google App Engine
Hi,

Can I change the default user agent of 'URL Fetch API '

Currently : AppEngine-Google; (+http://code.google.com/appengine)

Thanks,
Marc.

Anthony

unread,
May 9, 2008, 10:24:02 AM5/9/08
to Google App Engine
I use this:
result = urlfetch.fetch(u,headers = {'User-Agent': "Mozilla/5.0
(compatible; Reflectbot/1.0; +http://
re.flect.net)"},allow_truncated=True )

Marzia Niccolai

unread,
May 9, 2008, 11:45:34 AM5/9/08
to google-a...@googlegroups.com
Hi,
 This will work on the dev_appserver, but it will not work on Google App Engine, currently we do not allow applications to set the User-Agent field.  We are working on making the development web server match the behavior of Google App Engine in this case.

 If you would like to see this added as a feature, please search the issue tracker for this feature to star it if it exists, if it doesn't, feel free to add it.

-Marzia

vrypan

unread,
May 10, 2008, 2:55:54 PM5/10/08
to Google App Engine
Anthony's code works fine for me, even on the Google AppEngine.

> I use this:
> result = urlfetch.fetch(u,headers = {'User-Agent': "Mozilla/5.0
> (compatible; Reflectbot/1.0; +http://
> re.flect.net)"},allow_truncated=True )

-- panayotis.

Anthony

unread,
May 10, 2008, 4:42:20 PM5/10/08
to Google App Engine
Marzia is right.. its only working on the local dev server, live apps
are sending the Google header still, I found this on appspot which
shows the request headers: http://httpreqheaders.appspot.com/

I point my live app at it: http://re.flect.net/http://httpreqheaders.appspot.com/

And we get:

GET /
Host: httpreqheaders.appspot.com
User-Agent: AppEngine-Google; (+http://code.google.com/
appengine),gzip(gfe)

Marc D

unread,
May 11, 2008, 1:39:38 PM5/11/08
to Google App Engine
Ok Thanks,

The issue is here (342) :
http://code.google.com/p/googleappengine/issues/detail?id=342

Marc.

On May 9, 5:45 pm, "Marzia Niccolai" <ma...@google.com> wrote:
> Hi,
> This will work on the dev_appserver, but it will not work on Google App
> Engine, currently we do not allow applications to set the User-Agent field.
> We are working on making the development web server match the behavior of
> Google App Engine in this case.
>
> If you would like to see this added as a feature, please search the issue
> tracker for this feature to star it if it exists, if it doesn't, feel free
> to add it.
>
> -Marzia
>
Reply all
Reply to author
Forward
0 new messages