Invalid Token in ArcGIS API for Python Beta

09-15-2016 12:19 PM
New Contributor II

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

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("", "zzzz", "zzzz")----> 3 map ='Seattle, WA', 6) /opt/anaconda3/lib/python3.5/site-packages/arcgis/ in map(self, location, zoomlevel)    163         if location is not None:    164             if isinstance(location, str):--> 165        =    166             elif isinstance(location, tuple):    167        = location /opt/anaconda3/lib/python3.5/site-packages/arcgis/ in geocoder(self)    648         try:    649             geocodesvcurl =['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/ in __init__(self, item, url, gis)     71         }      72         #print(self.url)---> 73         svcprops =, params, use_ordered_dict=True)     74         collections.OrderedDict.__init__(self, svcprops)     75         try: /opt/anaconda3/lib/python3.5/site-packages/arcgis/_impl/ in post(self, path, postdata, files, ssl, compress, is_retry, use_ordered_dict, add_token)   2523                     postdata['token'] = newtoken   2524                     return, 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/ 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
0 Kudos
5 Replies
MVP Esteemed Contributor  apparently where beta stuff is supposed bo be asked 

/blogs/dan_patterson/2016/08/14/script-formatting  to format your code

0 Kudos
Regular Contributor II

I have the same question, and the Beta program is no longer accepting applications.

0 Kudos
MVP Esteemed Contributor

Although I personally think the ArcGIS Python API developers should engage more, or some, on GeoNet, the best place to ask questions for now is the beta forums.  If you join the public beta, you can access those forums.

New Contributor II

Thanks!  Will follow up on the Early Adopter site...  Forgot there was a separate forum over there...

0 Kudos
New Contributor

I've only just got this error come up when attempting to connect to our Portal in order to use the batch_geocode() method.

Obviously, I'm a little late to the party and applications for ArcGIS API for Python Beta have since closed on the Early Adopter site.

Did anyone find a solution to this problem?

0 Kudos