[Imdbpy-help] Problem accessing IMDB

40 views
Skip to first unread message

saruke kun

unread,
Feb 26, 2010, 10:08:22 AM2/26/10
to imdbp...@lists.sourceforge.net
With the example script on http://imdbpy.sourceforge.net/index.php?page=docs, the following problem with proxy occurs


2010-02-26 16:04:12,280 CRITICAL [imdbpy] c:\python26\lib\site-packages\imdbpy-4.4-py2.6-win32.egg\imdb\_exceptions.py:35: IMDbDataAccessError exception raised; args: ({'url': 'http://akas.imdb.com/find?s=tt;mx=20;q=The+Untouchables', 'error type': 'http_error_default', 'errcode': 403, 'headers': <httplib.HTTPMessage instance at 0x00D952D8>, 'proxy': '', 'errmsg': 'Forbidden'},); kwds: {}
None
Traceback (most recent call last):
  File "C:\Program Files\Apache2.2\htdocs\IMDB\YQuestLanguageModel\src\test_main.py", line 20, in <module>
    s_result = ia.search_movie('The Untouchables')
  File "c:\Python26\lib\site-packages\imdbpy-4.4-py2.6-win32.egg\imdb\__init__.py", line 381, in search_movie
    res = self._search_movie(title, results)
  File "c:\Python26\lib\site-packages\imdbpy-4.4-py2.6-win32.egg\imdb\parser\http\__init__.py", line 431, in _search_movie
    cont = self._get_search_content('tt', title, results)
  File "c:\Python26\lib\site-packages\imdbpy-4.4-py2.6-win32.egg\imdb\parser\http\__init__.py", line 414, in _get_search_content
    cont = self._retrieve(imdbURL_find % params)
  File "c:\Python26\lib\site-packages\imdbpy-4.4-py2.6-win32.egg\imdb\parser\http\__init__.py", line 400, in _retrieve
    return self.urlOpener.retrieve_unicode(url, size=size)
  File "c:\Python26\lib\site-packages\imdbpy-4.4-py2.6-win32.egg\imdb\parser\http\__init__.py", line 167, in retrieve_unicode
    uopener = self.open(url)
  File "c:\Python26\lib\urllib.py", line 206, in open
    return getattr(self, name)(url)
  File "c:\Python26\lib\urllib.py", line 361, in open_http
    return self.http_error(url, fp, errcode, errmsg, headers)
  File "c:\Python26\lib\urllib.py", line 378, in http_error
    return self.http_error_default(url, fp, errcode, errmsg, headers)
  File "c:\Python26\lib\site-packages\imdbpy-4.4-py2.6-win32.egg\imdb\parser\http\__init__.py", line 221, in http_error_default
    'proxy': self.get_proxy()}
imdb._exceptions.IMDbDataAccessError: {'url': 'http://akas.imdb.com/find?s=tt;mx=20;q=The+Untouchables', 'error type': 'http_error_default', 'errcode': 403, 'headers': <httplib.HTTPMessage instance at 0x00D952D8>, 'proxy': '', 'errmsg': 'Forbidden'}

Even if a proxy(http://localhost:80) is provided, 404 error is returned

2010-02-26 16:05:36,203 WARNING [imdbpy.parser.http.urlopener] c:\python26\lib\site-packages\imdbpy-4.4-py2.6-win32.egg\imdb\parser\http\__init__.py:214: 404 code returned for //akas.imdb.com/find?s=tt;mx=20;q=The+Untouchables: Not Found (headers: Date: Fri, 26 Feb 2010 15:05:36 GMT

Server: Apache/2.2.13 (Win32) PHP/5.2.10

Content-Length: 202

Connection: close

Content-Type: text/html; charset=iso-8859-1

)
Traceback (most recent call last):
  File "C:\Program Files\Apache2.2\htdocs\IMDB\YQuestLanguageModel\src\test_main.py", line 27, in <module>
    the_unt = s_result[0]
IndexError: list index out of range


I use Python 2.6.4 and IMDBpy 4.4. Please update if you have any ideas on the problem.

Thanks,
Saruke.

Davide Alberani

unread,
Feb 26, 2010, 10:20:11 AM2/26/10
to saruke kun, imdbp...@lists.sourceforge.net
On Feb 26, saruke kun <saruk...@googlemail.com> wrote:

> With the example script on http://imdbpy.sourceforge.net/index.php?page=docs,
> the following problem with proxy occurs

It's not a problem with proxies; I never noticed that IMDbPY (since...
always) sent 2 'User-agent' http headers; recently the IMDb server
changed its behaviour from:
- _accept_ the request if there's any _valid_ User-agent header.
to that:
- _refuse_ connection if there's any _not valid_ User-agent header.

The fix is in the SVN; see:
http://groups.google.com/group/imdbpy-users/browse_thread/thread/df785dc52ccdd3c5


--
Davide Alberani <davide....@gmail.com> [GPG KeyID: 0x465BFD47]
http://www.mimante.net/

------------------------------------------------------------------------------
Download Intel&#174; Parallel Studio Eval
Try the new software tools for yourself. Speed compiling, find bugs
proactively, and fine-tune applications for parallel performance.
See why Intel Parallel Studio got high marks during beta.
http://p.sf.net/sfu/intel-sw-dev
_______________________________________________
Imdbpy-help mailing list
Imdbp...@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/imdbpy-help

saruke kun

unread,
Feb 26, 2010, 10:36:14 AM2/26/10
to Davide Alberani, saruke kun, imdbp...@lists.sourceforge.net
Works, Thanks :-)
Reply all
Reply to author
Forward
0 new messages