浏览代码

g.extension: import requests for python3 as well as continuation of https://trac.osgeo.org/grass/changeset/74116 (fixes https://trac.osgeo.org/grass/ticket/3803) (contributed by pmav99)

git-svn-id: https://svn.osgeo.org/grass/grass/trunk@74323 15284696-431f-4ddb-bdfa-cd5b030d7da7
Markus Neteler 6 年之前
父节点
当前提交
10dd435b17
共有 1 个文件被更改,包括 4 次插入5 次删除
  1. 4 5
      scripts/g.extension/g.extension.py

+ 4 - 5
scripts/g.extension/g.extension.py

@@ -135,10 +135,11 @@ import atexit
 import shutil
 import zipfile
 import tempfile
+import xml.etree.ElementTree as etree
 from distutils.dir_util import copy_tree
 
+
 try:
-    import requests, zipfile
     from urllib2 import HTTPError, URLError, ProxyHandler, build_opener
     from urllib import urlopen, urlretrieve
 except ImportError:
@@ -146,10 +147,8 @@ except ImportError:
     from urllib.error import HTTPError, URLError
     from urllib.request import urlopen, urlretrieve, ProxyHandler, build_opener
 
-try:
-    import xml.etree.ElementTree as etree
-except ImportError:
-    import elementtree.ElementTree as etree  # Python <= 2.4
+import requests
+
 # Get the XML parsing exceptions to catch. The behavior changed with Python 2.7
 # and ElementTree 1.3.
 from xml.parsers import expat  # TODO: works for any Python?