Hi Joshua,
Also getting the same error using Jupyter Notebooks: label to long??
This is an ESRI token!!
Jupyter Notebooks error:
UnicodeError Traceback (most recent call last)~\anaconda3\lib\encodings\idna.py in encode(self, input, errors) 166 if len(labels[-1]) >= 64:--> 167 raise UnicodeError("label too long") 168 return result, len(input)UnicodeError: label too long The above exception was the direct cause of the following exception: UnicodeError Traceback (most recent call last)~\anaconda3\lib\site-packages\arcgis\gis\_impl\_con\_connection.py in post(self, path, params, files, **kwargs) 673 else:--> 674 resp = self._session.post(url=url, 675 data=params,~\anaconda3\lib\site-packages\requests\sessions.py in post(self, url, data, json, **kwargs) 577 --> 578 return self.request('POST', url, data=data, json=json, **kwargs) 579 ~\anaconda3\lib\site-packages\requests\sessions.py in request(self, method, url, params, data, headers, cookies, files, auth, timeout, allow_redirects, proxies, hooks, stream, verify, cert, json) 529 send_kwargs.update(settings)--> 530 resp = self.send(prep, **send_kwargs) 531 ~\anaconda3\lib\site-packages\requests\sessions.py in send(self, request, **kwargs) 642 # Send the request--> 643 r = adapter.send(request, **kwargs) 644 ~\anaconda3\lib\site-packages\requests\adapters.py in send(self, request, stream, timeout, verify, cert, proxies) 438 if not chunked:--> 439 resp = conn.urlopen( 440 method=request.method,~\anaconda3\lib\site-packages\urllib3\connectionpool.py in urlopen(self, method, url, body, headers, retries, redirect, assert_same_host, timeout, pool_timeout, release_conn, chunked, body_pos, **response_kw) 669 # Make the request on the httplib connection object.--> 670 httplib_response = self._make_request( 671 conn,~\anaconda3\lib\site-packages\urllib3\connectionpool.py in _make_request(self, conn, method, url, timeout, chunked, **httplib_request_kw) 380 try:--> 381 self._validate_conn(conn) 382 except (SocketTimeout, BaseSSLError) as e:~\anaconda3\lib\site-packages\urllib3\connectionpool.py in _validate_conn(self, conn) 975 if not getattr(conn, "sock", None): # AppEngine might not have `.sock`--> 976 conn.connect() 977 ~\anaconda3\lib\site-packages\urllib3\connection.py in connect(self) 307 # Add certificate verification--> 308 conn = self._new_conn() 309 hostname = self.host ~\anaconda3\lib\site-packages\urllib3\connection.py in _new_conn(self) 158 try:--> 159 conn = connection.create_connection( 160 (self._dns_host, self.port), self.timeout, **extra_kw ~\anaconda3\lib\site-packages\urllib3\util\connection.py in create_connection(address, timeout, source_address, socket_options) 60 ---> 61 for res in socket.getaddrinfo(host, port, family, socket.SOCK_STREAM): 62 af, socktype, proto, canonname, sa = res ~\anaconda3\lib\socket.py in getaddrinfo(host, port, family, type, proto, flags) 917 addrlist = []--> 918 for res in _socket.getaddrinfo(host, port, family, type, proto, flags): 919 af, socktype, proto, canonname, sa = res UnicodeError: encoding with 'idna' codec failed (UnicodeError: label too long) During handling of the above exception, another exception occurred: Exception Traceback (most recent call last)<ipython-input-2-0051d4567ffa> in <module> 21 22 ---> 23 portal = GIS(portalURL+token, username, password, verify_cert=False) 24 25 #### Get Users and Items~\anaconda3\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) 337 "argument when connecting to the GIS.") 338 else:--> 339 raise e 340 try: 341 if url.lower().find("arcgis.com") > -1 and \~\anaconda3\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) 312 self._expiration = 60 313 try:--> 314 self._portal = _portalpy.Portal(self._url, self._username, 315 self._password, self._key_file, 316 self._cert_file,~\anaconda3\lib\site-packages\arcgis\gis\_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, custom_auth, token) 167 token=token) 168 #self.get_version(True)--> 169 self.get_properties(True) 170 171 ~\anaconda3\lib\site-packages\arcgis\gis\_impl\_portalpy.py in get_properties(self, force) 1107 resp = self.con.get(path, ssl=True) # issue seen with key, cert auth 1108 if not resp:-> 1109 raise e 1110 1111 if resp:~\anaconda3\lib\site-packages\arcgis\gis\_impl\_portalpy.py in get_properties(self, force) 1095 resp = None 1096 try:-> 1097 resp = self.con.post(path, self._postdata(), ssl=True) 1098 except Exception as e: 1099 if not self.con._verify_cert and \~\anaconda3\lib\site-packages\arcgis\gis\_impl\_con\_connection.py in post(self, path, params, files, **kwargs) 619 params.pop('token', None) 620 #pass--> 621 elif token_as_header == False and self.token is not None: #as ?token= 622 params['token'] = self.token 623 elif token_as_header and self.token is not None:#(token and token != _DEFAULT_TOKEN): # as X-Esri-Auth header with given token~\anaconda3\lib\site-packages\arcgis\gis\_impl\_con\_connection.py in token(self) 1026 "AGO", "ENTERPRISE"] and \ 1027 self._auth == "BUILTIN":-> 1028 self._token = self._enterprise_token() 1029 return self._token 1030 else:~\anaconda3\lib\site-packages\arcgis\gis\_impl\_con\_connection.py in _enterprise_token(self) 1141 path.split('/')[0]) 1142 -> 1143 res = self.post(path=self._token_url, 1144 params=postdata, 1145 add_token=False) ~\anaconda3\lib\site-packages\arcgis\gis\_impl\_con\_connection.py in post(self, path, params, files, **kwargs) 698 "URL scheme must be provided: %s" % errMS) 699 except Exception as e:--> 700 raise Exception('A general error occurred: %s' % e) 701 except: 702 import traceback Exception: A general error occurred: encoding with 'idna' codec failed (UnicodeError: label too long)