AnsweredAssumed Answered

Invalid Token in ArcGIS API for Python Beta

Question asked by dsmith04_EPA on Sep 15, 2016
Latest reply on Mar 8, 2017 by jay2datee

I'm attempting to run a code sample for the ArcGIS API for Python Beta and am running into the following issue:  when I try to render a map, it throws the error "invalid token" - despite being successfully get results via other operations like gis.users.get() and gis.content.search()

 

Stack trace is below (with account values replaced with 'zzzz')

 

RuntimeError                              Traceback (most recent call last)<ipython-input-15-6b70d1620c0f> in <module>()      1 from arcgis.gis import GIS      2 gis = GIS("https://zzzz.maps.arcgis.com", "zzzz", "zzzz")----> 3 map = gis.map('Seattle, WA', 6) /opt/anaconda3/lib/python3.5/site-packages/arcgis/gis.py in map(self, location, zoomlevel)    163         if location is not None:    164             if isinstance(location, str):--> 165                 mapwidget.center = self.tools.geocoder.find_best_match(location)    166             elif isinstance(location, tuple):    167                 mapwidget.center = location /opt/anaconda3/lib/python3.5/site-packages/arcgis/gis.py in geocoder(self)    648         try:    649             geocodesvcurl = self._gis.properties['helperServices']['geocode'][0]['url']--> 650             self._geocoder = Geocoder(None, geocodesvcurl, self._gis)    651             return self._geocoder    652         except KeyError: /opt/anaconda3/lib/python3.5/site-packages/arcgis/tools.py in __init__(self, item, url, gis)     71         }      72         #print(self.url)---> 73         svcprops = self._portal.con.post(self.url, params, use_ordered_dict=True)     74         collections.OrderedDict.__init__(self, svcprops)     75         try: /opt/anaconda3/lib/python3.5/site-packages/arcgis/_impl/portalpy.py in post(self, path, postdata, files, ssl, compress, is_retry, use_ordered_dict, add_token)   2523                     postdata['token'] = newtoken   2524                     return self.post(path, postdata, files, ssl, compress, -> 2525                                      is_retry=True)   2526                 elif errorcode == 498:   2527                     raise RuntimeError('Invalid token') /opt/anaconda3/lib/python3.5/site-packages/arcgis/_impl/portalpy.py in post(self, path, postdata, files, ssl, compress, is_retry, use_ordered_dict, add_token)   2525                                      is_retry=True)    2526                 elif errorcode == 498:-> 2527                     raise RuntimeError('Invalid token')   2528                 self._handle_json_error(resp_json['error'])   2529                 return None RuntimeError: Invalid token

Outcomes