I can use the GIS module on our organization's Community Hub site.
rom arcgis.gis import GIS
gis = GIS("https://willcounty.maps.arcgis.com/", "user", "password")
But, I can't on ArcGIS Hub. This attempt is from an anaconda environment. I also tried from an Pro environment and got same error.
from arcgis.gis import GIS
gis = GIS("https://willcountygis.hub.arcgis.com/", "username", "password")
#Error:
---------------------------------------------------------------------------
JSONDecodeError Traceback (most recent call last)
<ipython-input-5-0190cb412727> in <module>
1 from arcgis.gis import GIS
----> 2 gis = GIS("https://willcountygis.hub.arcgis.com/", "username", "password")
c:\ProgramData\Anaconda3\envs\py37\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)
481 )
482 else:
--> 483 raise e
484 try:
485 if (
c:\ProgramData\Anaconda3\envs\py37\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)
442 trust_env=kwargs.get("trust_env", None),
443 timeout=self._timeout,
--> 444 proxy=kwargs.get("proxy", None),
445 )
446 if self._portal.is_kubernetes:
c:\ProgramData\Anaconda3\envs\py37\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, **kwargs)
203 )
204 # self.get_version(True)
--> 205 self.get_properties(True)
206
207 def add_group_users(self, user_names, group_id, admin_names):
c:\ProgramData\Anaconda3\envs\py37\lib\site-packages\arcgis\gis\_impl\_portalpy.py in get_properties(self, force)
1225 ) # issue seen with key, cert auth
1226 if not resp:
-> 1227 raise e
1228
1229 if resp:
c:\ProgramData\Anaconda3\envs\py37\lib\site-packages\arcgis\gis\_impl\_portalpy.py in get_properties(self, force)
1205 resp = None
1206 try:
-> 1207 resp = self.con.post(path, self._postdata(), ssl=True)
1208 except Exception as e:
1209 if (
c:\ProgramData\Anaconda3\envs\py37\lib\site-packages\arcgis\gis\_impl\_con\_connection.py in post(self, path, params, files, **kwargs)
964 params.pop("token", None)
965 # pass
--> 966 elif token_as_header == False and self.token is not None: # as ?token=
...
354 except StopIteration as err:
--> 355 raise JSONDecodeError("Expecting value", s, err.value) from None
356 return obj, end
JSONDecodeError: Expecting value: line 1 column 1 (char 0)
According to the GIS Module help docs it doesn't look like you can access Hub. Is there any other way?
GIS : represents the GIS, either ArcGIS Online or an ArcGIS Portal