arcgis.mapping.ogc.WMSLayer problem with proxy or ssl?

329
1
10-25-2021 06:09 AM
RichardReinicke
Occasional Contributor II

Hi,

I'm connecting to our on premise Portal, only available in our network, so I don't use proxy.

gis = GIS(portal_url, username, portal_user_password, verify_cert=False)

connection works

 

After that I'm creating a new web map

new_map = WebMap()

works

Now I'm querying an item from our portal which is of type "WMS". This works as well but the WMS has an Internet URL.

Now I want to add this Internet WMS to my webmap:

wms_layer = WMSLayer(wmslayer[0].url)

works

But when I do 

new_map .add_layer(wms_layer.layers[0])

I get an error:


A connection error has occurred: HTTPSConnectionPool(host='our.internet.domain', port=443): Max retries exceeded with url: /arcgis/services/wms/some_service/MapServer/WMSServer?service=WMS&request=GetCapabilities&version=1.3.0&token=short-live-token (Caused by NewConnectionError('<urllib3.connection.HTTPSConnection object at 0x000001A3853E41C8>: Failed to establish a new connection: [Errno 11001] getaddrinfo failed'))

How can I tell urlllib3 or the arcgis API to use proxy on specific requests but not for my portal itself?

Tags (3)
0 Kudos
1 Reply
RichardReinicke
Occasional Contributor II

I've been able to resolve the public URL for our internal tests so the name resolution error is gone.

But now there seems to be another issue with the WMSLayer().

I'm passing the whole WMSLayer to map.add_layer() at the moment. 

<ipython-input-67-6b3ee09406c0> in map_add_layer(map, layer, options)
      1 def map_add_layer(map, layer, options):
----> 2     map.add_layer(layer, options=options)
      3 
      4 if map_layers[0].isWebLayer and "wms" in map_layers[0].dataSource.lower():
      5     # Try to find WMS in portal sources

~\AppData\Local\ESRI\conda\envs\arcgispro-py3-clone1\lib\site-packages\arcgis\mapping\_types.py in add_layer(self, layer, options)
    426             return True
    427         elif isinstance(layer, BaseOGC):
--> 428             lyr = layer._lyr_json
    429             title = lyr["title"]
    430             opacity = lyr["opacity"]

~\AppData\Local\ESRI\conda\envs\arcgispro-py3-clone1\lib\site-packages\arcgis\mapping\ogc\_wms.py in _lyr_json(self)
    198             "url" : self._url,
    199             "version" : self._version,
--> 200             "sublayers" : [{'name' : lyr.Name} for lyr in self.layers],
    201             "minScale" : self.scale[0],
    202             "maxScale" : self.scale[1],

~\AppData\Local\ESRI\conda\envs\arcgispro-py3-clone1\lib\site-packages\arcgis\mapping\ogc\_wms.py in <listcomp>(.0)
    198             "url" : self._url,
    199             "version" : self._version,
--> 200             "sublayers" : [{'name' : lyr.Name} for lyr in self.layers],
    201             "minScale" : self.scale[0],
    202             "maxScale" : self.scale[1],

AttributeError: 'str' object has no attribute 'Name'

 

Am I doing anything wrong? Why are there internal type conflicts in WMSLayer object? It's an ArcGIS Server WMS with Esri Python API.

0 Kudos