I am using Network Analyst to calculate the travel time from point A to point B. I need to do this for thousands of points, so the obvious solution is automating in Python. While I can write a script that calls the relevant ArcPy tools, I'd like to be able to just call our network analyst webservice and parse its results -- I only need the travel time, not the turn-by-turn directions, the route, or any of the other informative results produced through Network Analyst. I assumed that would be faster.
Based on this answer and the Requests module documentation, I thought this would work:
import requests
response = requests.get('http://[url]/arcgis/rest/services/Click/ClickRouting/NAServer/Route',
auth=('[user]', '[password]'))
print response.text
print response.json()
BUT, I'm getting a 401 error that claims I don't have permission, even though I can see it just fine through a web browser. Our ArcGIS server guy says that service is not restricted, and doesn't know why there would be an authentication error.
<h2>401 - Unauthorized: Access is denied due to invalid credentials.</h2>
<h3>You do not have permission to view this directory or page using the credentials that you supplied.</h3>
Am I not using requests
correctly, or is this a service configuration issue?
(If this doesn't have enough to do with GIS, I apologize; either migrate, or I will ask again on StackOverflow.)