fix gettitle errors
This will cause errors in gettitle, such as an HTTP 405 Method Not Allowed response, to not send out an ugly exception. This was a bug that got introduced due to the switch to requests.master
parent
26f37e83be
commit
8fa37b3056
|
@ -152,7 +152,7 @@ def gettitle(phenny, uri):
|
|||
#bytes = u.read(262144)
|
||||
#u.close()
|
||||
|
||||
except web.ConnectionError:
|
||||
except:
|
||||
return
|
||||
|
||||
m = r_title.search(bytes)
|
||||
|
|
|
@ -49,3 +49,12 @@ class TestHead(unittest.TestCase):
|
|||
snarfuri(self.phenny, input)
|
||||
|
||||
self.phenny.msg.assert_called_once_with('#phenny', "[ Google ]")
|
||||
|
||||
def test_snarfuri_405(self):
|
||||
self.phenny.config.prefix = '.'
|
||||
self.phenny.config.linx_api_key = ""
|
||||
input = Mock(group=lambda x=0: 'http://ozuma.sakura.ne.jp/httpstatus/405',
|
||||
sender='#phenny')
|
||||
snarfuri(self.phenny, input)
|
||||
|
||||
self.assertEqual(self.phenny.msg.called, False)
|
||||
|
|
Loading…
Reference in New Issue