Select to view content in your preferred language

Does arcgis.gis.GIS work with a stand-alone Enterprise or do you have to have Portal?

1663
5
06-12-2018 05:42 AM
deleted-user-z2GLgII8IrQ9
Deactivated User

I'm trying to run either of these examples from 

arcgis.gis module — arcgis 1.4.2 documentation 

on my stand-alone enterprise GIS (10.6).

# Usage Example 3: Built-in Login to ArcGIS Enterprisegis = GIS(url="http://pythonplayground.esri.com/portal",      username="user1", password="password1")
# Usage Example 4: Built-in Login to ArcGIS Enterprise, ignoring SSL errorsgis = GIS(url="http://pythonplayground.esri.com/portal", username="user1",          password="password1", verify_cert=False)

But, I keep getting an error cascade that includes:

RuntimeError: (gaierror(11001, 'getaddrinfo failed'),)

.

It's a little confusing in the documentation, but I can read it once and seems Enterprise-only is fine, and another time it seems to say you need Portal.

This is a new server installation and is otherwise pretty vanilla.

Thanks,

Mike

Tags (1)
5 Replies
by Anonymous User
Not applicable

An ArcGIS Enterprise Deployment typically contains at least a Portal with Web Adapter, a Server with Web Adapter, and a Data Store. You can use the Python API to connect to your Enterprise using the GIS object by specifying the url to your Portal. 

gis = GIS("https://mycompanydomain.com/portal","username","password",verify_cert=False)

The error you are seeing implies to me that you cannot resolve the hostname of your portal. Is the url correct? Can you access that same url via a web-browser?

0 Kudos
deleted-user-z2GLgII8IrQ9
Deactivated User

Thanks - that could be it.

The url I'm using is correct to the web adapter.

I'll check the Portal installation (and if they installed it even, when setting this up).

-Mike

0 Kudos
JoshuaBixby
MVP Esteemed Contributor

Including the whole error traceback gives community members much more to comment on.  I use the ArcGIS API for Python with stand-alone ArcGIS Enterprise deployments all the time.

0 Kudos
deleted-user-z2GLgII8IrQ9
Deactivated User

Here's the error output.  I should have thought of including this originally

Jupyter notebook cell:

from arcgis.gis import GIS
gis = GIS("https://my.arcgisurl.com/arcgis", username="MYUSERNAME", password="MYPASSWORD", verify_cert=False)

I've got the server admin guy checking to make sure there isn't some other ssl cert thing going on, but other operations seem to work.

thanks

- Mike

---------------------------------------------------------------------------HTTPError                                 Traceback (most recent call last)C:\Program Files\ArcGIS\Pro\bin\Python\envs\arcgispro-py3\lib\site-packages\arcgis\gis\__init__.py in __init__(self, url, username, password, key_file, cert_file, verify_cert, set_active, client_id, profile, **kwargs)    261                                            verify_cert=self._verify_cert,--> 262                                            client_id=self._client_id)    263         except Exception as e:C:\Program Files\ArcGIS\Pro\bin\Python\envs\arcgispro-py3\lib\site-packages\arcgis\_impl\portalpy.py in __init__(self, url, username, password, key_file, cert_file, expiration, referer, proxy_host, proxy_port, connection, workdir, tokenurl, verify_cert, client_id)    162                                              verify_cert=verify_cert,--> 163                                              client_id=client_id)    164         #self.get_version(True)C:\Program Files\ArcGIS\Pro\bin\Python\envs\arcgispro-py3\lib\site-packages\arcgis\_impl\connection.py in __init__(self, baseurl, tokenurl, username, password, key_file, cert_file, expiration, all_ssl, referer, proxy_host, proxy_port, connection, verify_cert, client_id)    283         if cert_file is None and key_file is None:--> 284             self.login(username, password, expiration, client_id)    285  C:\Program Files\ArcGIS\Pro\bin\Python\envs\arcgispro-py3\lib\site-packages\arcgis\_impl\connection.py in login(self, username, password, expiration, client_id)    526 --> 527             resp = self.post('', { 'f': 'json' }, add_token=False) # probe portal to find auth scheme    528                                                   # if basic, digest, NTLM or Kerberos, etc is being usedC:\Program Files\ArcGIS\Pro\bin\Python\envs\arcgispro-py3\lib\site-packages\arcgis\_impl\connection.py in post(self, path, postdata, files, ssl, compress, is_retry, use_ordered_dict, add_token, verify_cert, token, try_json, out_folder, file_name, force_bytes, add_headers)   1085             #print("***"+url)-> 1086             resp = opener.open(url, data=encoded_postdata.encode())   1087             resp_data, is_file = self._process_response(resp, C:\Program Files\ArcGIS\Pro\bin\Python\envs\arcgispro-py3\lib\urllib\request.py in open(self, fullurl, data, timeout)    531             meth = getattr(processor, meth_name)--> 532             response = meth(req, response)    533  C:\Program Files\ArcGIS\Pro\bin\Python\envs\arcgispro-py3\lib\urllib\request.py in http_response(self, request, response)    641             response = self.parent.error(--> 642                 'http', request, response, code, msg, hdrs)    643  C:\Program Files\ArcGIS\Pro\bin\Python\envs\arcgispro-py3\lib\urllib\request.py in error(self, proto, *args)    569             args = (dict, 'default', 'http_error_default') + orig_args--> 570             return self._call_chain(*args)    571  C:\Program Files\ArcGIS\Pro\bin\Python\envs\arcgispro-py3\lib\urllib\request.py in _call_chain(self, chain, kind, meth_name, *args)    503             func = getattr(handler, meth_name)--> 504             result = func(*args)    505             if result is not None:C:\Program Files\ArcGIS\Pro\bin\Python\envs\arcgispro-py3\lib\urllib\request.py in http_error_default(self, req, fp, code, msg, hdrs)    649     def http_error_default(self, req, fp, code, msg, hdrs):--> 650         raise HTTPError(req.full_url, code, msg, hdrs, fp)    651  HTTPError: HTTP Error 404: Not Found  During handling of the above exception, another exception occurred: IndexError                                Traceback (most recent call last)<ipython-input-13-eec4db1a8661> in <module>()      1 from arcgis.gis import GIS----> 2 gis = GIS("https://my.arcgisserver.com/arcgis", username="MYUSERNAME", password="MYPASSWORD", verify_cert=False)C:\Program Files\ArcGIS\Pro\bin\Python\envs\arcgispro-py3\lib\site-packages\arcgis\gis\__init__.py in __init__(self, url, username, password, key_file, cert_file, verify_cert, set_active, client_id, profile, **kwargs)    262                                            client_id=self._client_id)    263         except Exception as e:--> 264             if str(type(e.args[0])) == "<class 'ssl.SSLError'>":    265                 raise RuntimeError("An untrusted SSL error occurred when attempting to connect to the provided GIS.\n"    266                                    "If you trust this server and want to proceed, add 'verify_cert=False' as an "IndexError: tuple index out of range

0 Kudos
JoshuaBixby
MVP Esteemed Contributor

The text of the error message implies it is an untrusted cert, but I am guessing it may be a bit of a red herring since you are clearly passing verify_cert=False.  There is some kind of SSL error happening, what exactly isn't clear.  Asking your admin is a good start.