Select to view content in your preferred language

Token required in Notebook when querying a feature layer

801
3
01-23-2023 12:17 PM
EendrulatGH
Occasional Contributor

I have a notebook where i'm performing a simple query of a feature layer:

ago_item = gis.content.get("ITEM ID HERE")
itemFL = ago_item.layers[0]
itemResults = itemFL.query()

I frequently (but not always) get the error when executing:

Exception: Token Required
Token Required
(Error Code: 499)

I'm trying to understand why I get this error (though not consistently). I've tried various test cases :

  • Run on local jupyter notebook, accessing with same user account (no error)
  • Change way I access 'gis' from gis = GIS("home") to gis = GIS ('orgname','username', password')     (no error)
  • Shutdown/Restart kernel (still get error)

Anyone else experience this error?

 

 

 

0 Kudos
3 Replies
MaryEllenPerko
Occasional Contributor

Hi,

Have you had any luck with resolving this.  I am experiencing the same thing.  I can get the item then layer (confirmed with the layer url returned), but I get the token required error when I try to use the layer. 

Thanks.

0 Kudos
EendrulatGH
Occasional Contributor

Hi @MaryEllenPerko  - no I decided to work around it for now. I setup the notebook to run on a schedule, pass the username/password to the notebook as parameters. 

0 Kudos
MaryEllenPerko
Occasional Contributor

Hi.  Thanks for getting back to me.  Interestingly, I stopped receiving the error for about 2 weeks and this morning it came back.  I can't get anything done now. Just curious, is your account a named agol account or an enterprise account?  

Thanks.

0 Kudos