From a2ebf8304570ea59b43b33d5b97f6a969ecaf508 Mon Sep 17 00:00:00 2001 From: bunnyhero Date: Thu, 23 Dec 2010 13:06:11 -0500 Subject: [PATCH] compatibility with Python 2.7's changes to xmlrpc --- pyapns/client.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) 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):