On Jan 19, Yoav Aviram <yoav.avi...@gmail.com> wrote:

> I'm using IMDbPY-3.9 with HTTP and would like to use it withing
> Google App Engine.

I've played with it, but only locally and not for IMDbPY.

> The problem is that using Google's framework, all HTTP requests
> must be done using special API calls ('urlfetch').
> 
> Any previous experience with this?  Is there a ported version of
> the library?
> 
> If not - any thoughts on how difficult it will be to implement and
> how to go about doing it?

Should not be too difficult, I suppose.

Before you start coding, in my opinion you must check these things:
1. that what you're doing is not against IMDb's terms of service...
2. ...and not against Google's policy.
3. that it's possible, using 'urlfetch', to download an actual page
   from the IMDb web site: their web server doesn't like urllib (and
   other libraries) based scripts, and returns an error page if the
   request doesn't come with a "realistic" User-Agent.
   If it blocks requests from 'urlfetch' and there's no way to change
   the User-Agent, you can stop right there. :-)

Having done that, every request to the web server is served by
the imdb.parser.http.IMDbURLopener class, a subclass of
urllib.FancyURLopener.
In my opinion you should create a replacement class with the same
methods (some may be a noop [1], like set_proxy).
The nicest way to replace the default IMDbURLopen class with the
one you'll develop, could be a monkey patch [2] in the imdb._compat
module: here you must identify if you're running in a googleapps
environment, and replace it.

Hope this helps - if it works, let me know. :-)


+++
[1] http://en.wikipedia.org/wiki/Noop
[2] http://en.wikipedia.org/wiki/Monkey_patch
-- 
Davide Alberani <davide.alber...@gmail.com> [PGP KeyID: 0x465BFD47]
http://erlug.linux.it/~da/

------------------------------------------------------------------------------
This SF.net email is sponsored by:
SourcForge Community
SourceForge wants to tell your story.
http://p.sf.net/sfu/sf-spreadtheword
_______________________________________________
Imdbpy-devel mailing list
Imdbpy-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/imdbpy-devel

Reply via email to