Invalid Token in ArcGIS API for Python Beta

1518
5
09-15-2016 12:19 PM
DavidSmith21
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 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
0 Kudos
5 Replies
DanPatterson_Retired
MVP Esteemed Contributor

https://earlyadopter.esri.com/home.html  apparently where beta stuff is supposed bo be asked 

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

0 Kudos
MarkCederholm
Regular Contributor II

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

0 Kudos
JoshuaBixby
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.

DavidSmith21
New Contributor II

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

0 Kudos
JohnTsouvallas
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