diff --git a/pyapns/client.py b/pyapns/client.py index 2103356..dd90888 100644 --- a/pyapns/client.py +++ b/pyapns/client.py @@ -1,6 +1,7 @@ import xmlrpclib import threading import httplib +from sys import hexversion OPTIONS = {'CONFIGURED': False, 'TIMEOUT': 20} @@ -93,8 +94,12 @@ def ServerProxy(url, *args, **kwargs): class TimeoutTransport(xmlrpclib.Transport): def make_connection(self, host): - conn = TimeoutHTTP(host) - conn.set_timeout(self.timeout) + if hexversion < 0x02070000: + conn = TimeoutHTTP(host) + conn.set_timeout(self.timeout) + else: + conn = TimeoutHTTPConnection(host) + conn.timeout = self.timeout return conn class TimeoutHTTPConnection(httplib.HTTPConnection):