Select to view content in your preferred language

Start Stop Map Service arcpy

18424
24
Jump to solution
11-17-2016 10:56 AM
jaykapalczynski
Honored Contributor

Is there a way to stop and start a map/feature service in ArcGIS Server via python?

24 Replies
jaykapalczynski
Honored Contributor

THANK YOU ALL SO VERY MUCH....SO VERY APPRECIATED.....Have a great thanksgiving...cheers

0 Kudos
CraigPrisland2
Regular Contributor

Thank you all for posting to this thread.  It has been extremely useful for me.  I did have one question regarding an error that I am receiving.  When I run my script, it appears to run successfully until I hit this part of the code:

try:
        # Request the token
        with contextlib.closing(urllib2.urlopen(url, query_string)) as jsonResponse:
            getTokenResult = json.loads(jsonResponse.read())
            ## Validate result
            if "token" not in getTokenResult or getTokenResult == None:
                raise Exception("Failed to get token: {}".format(getTokenResult['messages']))
            else:
                return getTokenResult['token']
    except urllib2.URLError, e:
        raise Exception("Could not connect to machine {} on port {}\n{}".format(server, port, e))

Once it hits this section, I am getting the following error.  Any assistance as to why I am getting this error would be greatly appreciate. 

Could not connect to machine <myserver> on port <myport>
<urlopen error [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed (_ssl.c:590)>

Thanks in advance,

Craig

0 Kudos
BlakeTerhune
MVP Frequent Contributor

I don't know much about SSL and certificates, but maybe you can find an answer here.

0 Kudos
jaykapalczynski
Honored Contributor

I am not too familiar with this code snip as I received it through this post....but seems that its trying to authenticate a certificate on the server....

do you have valid certificates on the server?

Does the user specified have the appropriate permissions to do this task?

Callum Smith any thoughts?

CraigPrisland2
Regular Contributor

Yes, valid certificates are on the server and the user specified in the code does have full permissions.

0 Kudos