[PATCH 07 of 52 Narval cube] [new style] fix errors linked to urllib2

Nsukami Patrick ptrck at nskm.xyz
Wed Apr 1 11:34:07 CEST 2020


# HG changeset patch
# User Nsukami Patrick <ptrck at nskm dot xyz>
# Date 1585413890 0
#      Sat Mar 28 16:44:50 2020 +0000
# Node ID d2064d69a600f58b38a3066716701124dce56611
# Parent  394efcb13ac25e5b17092e4dc7ef3e1ad87f6cdd
[new style] fix errors linked to urllib2

- rename urllib2 to urllib
- remove useless imports of urlparse & urljoin

diff --git a/cubicweb_narval/narvalbot/__init__.py b/cubicweb_narval/narvalbot/__init__.py
--- a/cubicweb_narval/narvalbot/__init__.py
+++ b/cubicweb_narval/narvalbot/__init__.py
@@ -30,7 +30,6 @@
 import requests
 from datetime import datetime
 from hashlib import md5
-from urlparse import urlparse
 
 from logilab.common.configuration import Configuration, Method
 from logilab.common.logging_ext import set_log_methods
diff --git a/cubicweb_narval/narvalbot/server.py b/cubicweb_narval/narvalbot/server.py
--- a/cubicweb_narval/narvalbot/server.py
+++ b/cubicweb_narval/narvalbot/server.py
@@ -29,7 +29,6 @@
 from subprocess import Popen
 from tempfile import TemporaryFile
 from threading import Thread, Condition, Timer, currentThread
-from urlparse import urljoin, urlparse
 from datetime import timedelta
 
 from logilab.common import tasksqueue
diff --git a/cubicweb_narval/testutils.py b/cubicweb_narval/testutils.py
--- a/cubicweb_narval/testutils.py
+++ b/cubicweb_narval/testutils.py
@@ -19,7 +19,7 @@
 import os
 import sys
 import subprocess
-import urllib2
+import urllib.error
 from cStringIO import StringIO
 from json import load
 
@@ -99,7 +99,7 @@
             data, req = self.http_publish(url, form)
             fp = StringIO(data)
             if req.status_out not in (200,303):
-                raise urllib2.HTTPError(url, req.status_out,
+                raise urllib.error.HTTPError(url, req.status_out,
                                         "Failed", req.headers_out, fp)
             try:
                 return load(fp)




More information about the cubicweb-devel mailing list