Update __init__.py
This commit is contained in:
parent
1c2a313002
commit
64d1c010a9
1 changed files with 5 additions and 2 deletions
|
|
@ -3,7 +3,10 @@ import json
|
||||||
import requests
|
import requests
|
||||||
import time
|
import time
|
||||||
from collections import namedtuple
|
from collections import namedtuple
|
||||||
from urllib import parse
|
try:
|
||||||
|
from urllib import parse as parse_url
|
||||||
|
except ImportError:
|
||||||
|
from urlparse import urlparse as parse_url
|
||||||
|
|
||||||
from .exceptions import ConnectionError, TimeoutError, PacketError
|
from .exceptions import ConnectionError, TimeoutError, PacketError
|
||||||
from .transports import _get_response, _negotiate_transport, TRANSPORTS
|
from .transports import _get_response, _negotiate_transport, TRANSPORTS
|
||||||
|
|
@ -364,7 +367,7 @@ def find_callback(args, kw=None):
|
||||||
def _parse_host(host, port):
|
def _parse_host(host, port):
|
||||||
if not host.startswith('http'):
|
if not host.startswith('http'):
|
||||||
host = 'http://' + host
|
host = 'http://' + host
|
||||||
url_pack = parse.urlparse(host)
|
url_pack = parse_url(host)
|
||||||
is_secure = url_pack.scheme == 'https'
|
is_secure = url_pack.scheme == 'https'
|
||||||
port = port or url_pack.port or (443 if is_secure else 80)
|
port = port or url_pack.port or (443 if is_secure else 80)
|
||||||
base_url = '%s:%d%s/socket.io/%s' % (
|
base_url = '%s:%d%s/socket.io/%s' % (
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue