2

I would like to be able to run a python script each morning that checks each sites map service layers for proper functionality. Currently we have 10 sites with map services hosted by Geocortex and Flex.

I am able to run a script to open our sites in a browser and return a url code if they are up and running using

import webbrowser
url = 'http://entgisweb01/CountyView/'
webbrowser.open_new(url)

import urllib2

def main():
  # open a connection to a URL using urllib2
  webUrl = urllib2.urlopen("http://gis.ventura.org/CountyViewNew")

 # get the result code and print it
  print "result code: " + str(webUrl.getcode())
  print "http://gis.ventura.org/CountyViewNew"

if __name__ == "__main__":
  main()

I would like to be able to check the layers of each map service within the sites using a python code instead of simply opening the site in a browser.

  • I think that you may need to look at the ArcGIS API for Python: blogs.esri.com/esri/arcgis/2017/12/22/… – PolyGeo Feb 14 '18 at 23:55
  • Yes, the ArcGIS API can do that, but all you really need is a list of service URLs and a "?f=json" appended to return service status... maybe 10 more lines of Python code. – Vince Feb 15 '18 at 0:53
0

There must be tools to check if all your ArcGIS map services are still running. You could simply do a http GET on each of the map service URls

  1. GET (urlopen) http://gis.ventura.org/arcgis/rest/AssessorParcelMap/MapServer
  2. Store the response. see if it is an error Look for "Error: Service AssessorParcelMap/MapServer not found Code: 500"
  3. If the ArcGIS map service is available, it will return the list of layers etc.

(This won't test if one of the layer is not accessible)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.