Initial port to python3
[htsworkflow.git] / htsworkflow / submission / ncbi.py
index 3cc87365ce0186fdeb2c6024bbba84fd04c6c4fa..89c0dc2f2e9d697ca66ded2fc911445de3152ec6 100644 (file)
@@ -9,7 +9,7 @@ from lxml.etree import parse, XSLT, tostring, fromstring
 from optparse import OptionParser
 import os
 import RDF
-import urllib
+import urllib.request, urllib.parse, urllib.error
 
 from htsworkflow.util.rdfhelp import get_model, dump_model
 
@@ -35,7 +35,7 @@ def search_ncbi_ids(database, term, return_max=200):
     search = {'db': database,
               'term': term,
               'retmax': return_max}
-    tree = parse(ESEARCH_URL + urllib.urlencode(search))
+    tree = parse(ESEARCH_URL + urllib.parse.urlencode(search))
     root = tree.getroot()
     count = get_node_scalar(root, '/eSearchResult/Count', int)
     retmax_node = get_node_scalar(root, '/eSearchResult/RetMax', int)
@@ -56,7 +56,7 @@ def parse_sra_metadata_into_model(model, ncbi_id):
     """
     search = {'db':DB,
               'id': ncbi_id}
-    url = EFETCH_URL + urllib.urlencode(search)
+    url = EFETCH_URL + urllib.parse.urlencode(search)
     tree = parse(url)
 
     context = Context()