mirror of
https://github.com/SickGear/SickGear.git
synced 2025-03-02 10:55:02 +00:00
22 lines
626 B
Python
22 lines
626 B
Python
|
# -*- coding: utf-8 -*-
|
||
|
import sys
|
||
|
import socket
|
||
|
|
||
|
|
||
|
if sys.version_info[0] == 2:
|
||
|
from xmlrpclib import ServerProxy, Transport
|
||
|
from httplib import HTTPConnection
|
||
|
elif sys.version_info[0] == 3:
|
||
|
from xmlrpc.client import ServerProxy, Transport
|
||
|
from http.client import HTTPConnection
|
||
|
|
||
|
|
||
|
class TimeoutTransport(Transport, object):
|
||
|
def __init__(self, timeout=socket._GLOBAL_DEFAULT_TIMEOUT, *args, **kwargs):
|
||
|
super(TimeoutTransport, self).__init__(*args, **kwargs)
|
||
|
self.timeout = timeout
|
||
|
|
||
|
def make_connection(self, host):
|
||
|
h = HTTPConnection(host, timeout=self.timeout)
|
||
|
return h
|