import os
from optparse import OptionGroup
-import urllib
-import urllib2
-import urlparse
+from six.moves import urllib
LOGGER = logging.getLogger(__name__)
Return a dictionary from the HTSworkflow API
"""
try:
- apipayload = urllib.urlencode(apidata)
- web = urllib2.urlopen(url, apipayload)
- except urllib2.URLError as e:
+ apipayload = urllib.parse.urlencode(apidata)
+ web = urllib.request.urlopen(url, apipayload)
+ except urllib.request.URLError as e:
if hasattr(e, 'code') and e.code == 404:
LOGGER.info("%s was not found" % (url,))
return None
import gzip
import bz2
import types
-import urllib2
+from six.moves import urllib
def isfilelike(file_ref, mode):
"""Does file_ref have the core file operations?
(AKA does it start with protocol:// ?)
"""
#what if mode is 'w'?
- parsed = urllib2.urlparse.urlparse(file_ref)
+ parsed = urllib.parse.urlparse(file_ref)
schema, netloc, path, params, query, fragment = parsed
return len(schema) > 0
elif isfilelike(file_ref, mode):
return file_ref
elif isurllike(file_ref, mode):
- return urllib2.urlopen(file_ref)
+ return urllib.request.urlopen(file_ref)
elif os.path.splitext(file_ref)[1] == ".gz":
return gzip.open(file_ref, mode)
elif os.path.splitext(file_ref)[1] == '.bz2':
import types
import logging
-import urlparse
from django.db import models
from django.contrib.auth.models import User, UserManager
from django.core import urlresolvers