From 35df2583bfe58fa87458bf8b6729e6608d8fa42f Mon Sep 17 00:00:00 2001 From: Richard O'Dwyer Date: Tue, 17 Apr 2018 20:07:38 +0100 Subject: [PATCH] fix title_exists --- HISTORY.rst | 2 ++ src/imdbpie/imdbpie.py | 8 ++++---- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/HISTORY.rst b/HISTORY.rst index 7c7499e..631b8f6 100644 --- a/HISTORY.rst +++ b/HISTORY.rst @@ -7,6 +7,8 @@ Release History ++++++++++++++++++ - Python 2.x setup.py bugfix. +- Bugfix for ``title_exists`` method returning ``None``. +- Bugfix for ``get_title`` raising an incorrect exception when redirection title. 5.4.3 (2018-04-05) diff --git a/src/imdbpie/imdbpie.py b/src/imdbpie/imdbpie.py index b4b661b..1ec68ba 100644 --- a/src/imdbpie/imdbpie.py +++ b/src/imdbpie/imdbpie.py @@ -103,9 +103,9 @@ class Imdb(Auth): def title_exists(self, imdb_id): self.validate_imdb_id(imdb_id) - page_url = 'http://www.imdb.com/title/{0}/'.format(imdb_id) + page_url = 'https://www.imdb.com/title/{0}/'.format(imdb_id) - response = self.session.head(page_url) + response = self.session.get(page_url, allow_redirects=False) if response.status_code == httplib.OK: return True @@ -298,8 +298,8 @@ class Imdb(Auth): def is_redirection_title(self, imdb_id): self.validate_imdb_id(imdb_id) - page_url = 'http://www.imdb.com/title/{0}/'.format(imdb_id) - response = self.session.head(page_url) + page_url = 'https://www.imdb.com/title/{0}/'.format(imdb_id) + response = self.session.get(page_url, allow_redirects=False) if response.status_code == httplib.MOVED_PERMANENTLY: return True else: -- 2.24.1