On Sep 18, "Garland, Ken R" <[EMAIL PROTECTED]> wrote:

> I could implement an exception, but first I'd like to know if I can
> capture the url of the attempted connection and force it to use
> another?

The url is in the returned exception.  You can do something like:

import imdb

ia = imdb.IMDb()
try:
    results = ia.search_movie('goonies')
except imdb.IMDbDataAccessError, e:
    print 'Ouch!', e.args[0].get('url')

Beware that, for exceptions accessing a proxy, the e.args[0] dictionary
will contain the 'fullurl' keyword, instead.
This makes me think that I should implement a better/cleaner way to
handle exceptions (e.args[0] is horrible...) :-)

> I'm wondering if imdb has another url for this service, and
> if one does not return response I would like to attempt the same
> search on the other server.

Won't work.
The used server (akas.imdb.com [1]) is hardcoded in two or three
places in the IMDbPY code; even if I suppose you can override it
with a monkey patch [2] you will face the fact that akas.imdb.com
and the other servers (us.imdb.com, uk.imdb.com, italian.imdb.com,
etc. etc.) are in fact _the same_ server (or better: they resolves
to the same IP address, whatever this IP materially is).
Actually, 207.171.166.140.

Besides that, what you got was a 'Name or service not known'
which smells like a problem on your side (your PC/network or
your provider DNS resolver), probably a timeout: it's really
unlikely that the imdb.com domain had such a noticeable problem
resolving one of its subdomains.


Ciao!

+++
[1] used because it will list every movie AKA in any language.
[2] http://en.wikipedia.org/wiki/Monkey_patch
    For sure the best solution would be to limit (ideally to one)
    the number of places were akas.imdb.com is hard-coded in
    IMDbPY, but at the moment I've very limited time. :-/
    As usual, any help is welcome.
-- 
Davide Alberani <[EMAIL PROTECTED]> [PGP KeyID: 0x465BFD47]
http://erlug.linux.it/~da/

-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2005.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
Imdbpy-devel mailing list
Imdbpy-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/imdbpy-devel

Reply via email to