Select to view content in your preferred language

ArcGIS Portal API - Accessing items from Python Script

2914
3
07-18-2012 08:35 AM
GaëtanLAVENU
Esri Contributor
Hi,

I would like to get a list of my AGOL for organization items from a python script.
- Is there a way to connect to my portal with a organizational account from Python script ?
- How to proceed to get a token with the generateToken Rest operation ?

Any response would be appreciated.

Regards,

Gaëtan LAVENU
Esri France
Tags (2)
0 Kudos
3 Replies
MikeMinami
Esri Notable Contributor
0 Kudos
GaëtanLAVENU
Esri Contributor
Hi,

I should probably be more precise in my question. I know how to do this with JavaScript API but I try to do it with Python. My issue is about specifying the "referer" parameter in the GenerateToken request. What kind of value should I put in the case of a Python script ?

Gaëtan.
0 Kudos
MikeMinami
Esri Notable Contributor
The answer from one of our devs here...

The referer passed into the generateToken call must be contained within the referer header passed in with each call. So if generate token is called with referer=acme.com all calls using it must have a HTTP Referer header that contains that string, for instance �??http://maps.acme.com/mypage.html�??. Browsers automatically set this to whatever page the call is coming from and this cannot be overridden.

If the token is requested and used from Python then you can set whatever you want, and just make sure that the calls made to the API contain the same Referer string as was used to get the token. It could be a url, a session id, or whatever.


Thanks,

Mike
0 Kudos