소스 검색

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?