views:

165

answers:

1

A normal urllib2 works fine:

>>> import urllib2
>>> r = urllib2.urlopen(u"http://bit.ly/4ovTZw")
>>> r.geturl()
'http://www.writing.com/main/handler/action/show_document/item_id/933413.mp3'
>>> r.headers.get("Content-Type")
'audio/mpeg'

But in appengine, the same code shows text/html.

def get(self):
    r = urllib2.urlopen(u"http://bit.ly/4ovTZw")
    self.response.out.write( r.geturl() )
    self.response.out.write( r.headers.get("Content-Type") )
    return

Can I get around this? Why is this happening?

A: 

I know for a fact that AppEngine blacklists some addresses - check your response body for a hint.

It might also be the other way around - some services blacklist AppEngine... I am not sure. I remember in the early days of GAE, accessing Delicious was not possible through AppEngine.

jldupont