I'm trying to convert some data got from urlfetch to native python file object. Does anyone know how to do this?
I understand GAE can't save files to local. But I need file object due to library's specification.
I'm trying to convert some data got from urlfetch to native python file object. Does anyone know how to do this?
I understand GAE can't save files to local. But I need file object due to library's specification.
You can use python's StringIO class to wrap a a file-like object around any data retrieved by URL Fetch.
If you use python's urllib2.urlopen() instead of Google's URL Fetch API, you'll get a file-like object which might work with your library.
If you just need a file-like object, you can use urllib2, which on GAE is a wrapper around urlfetch.
urlopen
returns the file-like object. I don't know of a way you could get a true file handle for a downloaded URL.