Select to view content in your preferred language

arcpy & web tier auth

681
4
05-29-2020 11:47 AM
BillChappell
Frequent Contributor

I started a new job and one of the tasks given to me was to write some python to work with their ArcServer REST services. I first thought it was token protected but I found out that they federated it with portal and it's all web tier authenticated. 

I'm trying to hit the url with requests but keep getting a need token response but even if i get a token it screams at the SSL true parameter.  Any ideas?

Tags (1)
0 Kudos
4 Replies
JoshuaBixby
MVP Esteemed Contributor

What Python packages and functions are you using to "hit the url with requests'?

0 Kudos
BillChappell
Frequent Contributor

python 2.7

import requests

import urllib

import urllib2

import json

I should be able to hit the REST endpoint and return the JSON data.

Also on the list is to return info on the services but for now i'm just

trying to connect.

Internally when I hit the server with a browser, it passes my single

sign on creds and returns the JSON but not with python.

0 Kudos
JoshuaBixby
MVP Esteemed Contributor

Esri has done all of the heavy lifting of making ArcGIS REST API calls from Python by creating ArcGIS API for Python | ArcGIS for Developers.  I encourage you to use that API instead of trying to roll your own ArcGIS REST API calls from Python.

0 Kudos
BillChappell
Frequent Contributor

I’ll look into that on Monday. Thanks

Sent from my iPhone

0 Kudos