[GRASS-dev] [GRASS GIS] #3179: g.extension not installing addons behind proxy

GRASS GIS trac at osgeo.org
Wed Jan 10 23:34:46 PST 2018


#3179: g.extension not installing addons behind proxy
--------------------------+----------------------------------------
  Reporter:  madi         |      Owner:  grass-dev@…
      Type:  defect       |     Status:  new
  Priority:  normal       |  Milestone:  7.4.0
 Component:  Addons       |    Version:  unspecified
Resolution:               |   Keywords:  g.extension, proxy, addons
       CPU:  Unspecified  |   Platform:  Unspecified
--------------------------+----------------------------------------

Comment (by mmetz):

 Replying to [ticket:3179 madi]:
 > Related to https://lists.osgeo.org/pipermail/grass-
 user/2016-October/075337.html
 >
 > when i try to use g.extension behind a proxy, following the example from
 the manual, it gives me the following error:
 >
 > {{{
 > g.extension ext=i.segment.hierarchical proxy="http://xx.xxx.xxx.xx:xxxx"
 > Traceback (most recent call last):
 >   File "/usr/local/grass-7.3.svn/scripts/g.extension", line 1730, in
 <module>
 >     sys.exit(main())
 >   File "/usr/local/grass-7.3.svn/scripts/g.extension", line 1675, in
 main
 >     for ptype, purl in (p.split('=') for p in
 options['proxy'].split(',')):
 > ValueError: need more than 1 value to unpack
 > }}}
 >
 > Using the form suggested by Pietro:
 >
 > {{{
 > proxy="http=<value>,ftp=<value>"
 > }}}
 >
 > {{{
 > g.extension ext=i.segment.hierarchical
 proxy="http=http://xx.xxx.xxx.xx:xxxx"
 > }}}
 >
 > gives:
 >
 > {{{
 > Fetching <i.segment.hierarchical> from GRASS GIS Addons repository (be
 > patient)...
 > ERROR: Extension <i.segment.hierarchical> not found
 > }}}
 >
 > which is exactly the same as if I don't indicate the proxy at all.

 According to Python docs, "Proxies which require authentication for use
 are not currently supported; this is considered an implementation
 limitation" in urllib, and `g.extension` uses urllib, not urllib2 to open
 urls.

 >
 > FWIW, I normally use urllib2 to handle the proxy. However I have some
 difficulties to apply this simple method to the 1700+ rows code (handling
 several different addons sources for several os's) of g.extension, but I'm
 behind a proxy and I'm available to test if you have a patch.
 >
 > Here's what I do in python:
 >
 > {{{
 > import urllib2
 > import os
 > proxy = urllib2.ProxyHandler({'http':os.environ['HTTP_PROXY']})
 > opener = urllib2.build_opener(proxy)
 > urllib2.install_opener(opener)
 > urllib2.urlopen('http://www.google.com')
 > }}}

 That should also work for `g.extension`, including authentification.

--
Ticket URL: <https://trac.osgeo.org/grass/ticket/3179#comment:4>
GRASS GIS <https://grass.osgeo.org>



More information about the grass-dev mailing list