Skip to content
Permalink
Browse files

Fix DeprecationWarning on Python 3.8

  /home/travis/build/Supervisor/supervisor/supervisor/xmlrpc.py:489: DeprecationWarning: urllib.parse.splittype() is deprecated as of 3.8, use urllib.parse.urlparse() instead
    type, uri = urllib.splittype(serverurl)

  /home/travis/build/Supervisor/supervisor/supervisor/xmlrpc.py:490: DeprecationWarning: urllib.parse.splithost() is deprecated as of 3.8, use urllib.parse.urlparse() instead
    host, path = urllib.splithost(uri)

  /home/travis/build/Supervisor/supervisor/supervisor/xmlrpc.py:491: DeprecationWarning: urllib.parse.splitport() is deprecated as of 3.8, use urllib.parse.urlparse() instead
    host, port = urllib.splitport(host)
  • Loading branch information...
mnaberez committed Sep 8, 2019
1 parent d26cf9d commit de5e719e8d49405f4efa2299aedf72617218132e
Showing with 7 additions and 8 deletions.
  1. +4 −2 supervisor/http.py
  2. +3 −6 supervisor/xmlrpc.py
@@ -12,10 +12,11 @@
except ImportError: # Windows
import getpass as pwd

from supervisor.compat import urllib
from supervisor.compat import sha1
from supervisor.compat import as_bytes
from supervisor.compat import as_string
from supervisor.compat import urlparse

from supervisor.medusa import asyncore_25 as asyncore
from supervisor.medusa import http_date
from supervisor.medusa import http_server
@@ -315,7 +316,8 @@ def get_server_url(self):

if 'HTTP_HOST' in environ:
host = environ['HTTP_HOST'].strip()
hostname, port = urllib.splitport(host)
parsed = urlparse.urlparse(host)
hostname, port = parsed.hostname, str(parsed.port)
else:
hostname = environ['SERVER_NAME'].strip()
port = environ['SERVER_PORT']
@@ -9,13 +9,13 @@

from supervisor.compat import xmlrpclib
from supervisor.compat import StringIO
from supervisor.compat import urllib
from supervisor.compat import as_bytes
from supervisor.compat import as_string
from supervisor.compat import encodestring
from supervisor.compat import decodestring
from supervisor.compat import httplib
from supervisor.compat import PY2
from supervisor.compat import urlparse

from supervisor.medusa.http_server import get_header
from supervisor.medusa.xmlrpc_handler import xmlrpc_handler
@@ -486,13 +486,10 @@ def __init__(self, username=None, password=None, serverurl=None):
self.verbose = False
self.serverurl = serverurl
if serverurl.startswith('http://'):
type, uri = urllib.splittype(serverurl)
host, path = urllib.splithost(uri)
host, port = urllib.splitport(host)
parsed = urlparse.urlparse(serverurl)
host, port = parsed.hostname, parsed.port
if port is None:
port = 80
else:
port = int(port)
def get_connection(host=host, port=port):
return httplib.HTTPConnection(host, port)
self._get_connection = get_connection

0 comments on commit de5e719

Please sign in to comment.
You can’t perform that action at this time.