Select to view content in your preferred language

Altering mss.py for https only server

958
4
01-23-2023 08:22 AM
berniejconnors
Frequent Contributor

I found a great script a few years ago to generate a report for the map service requests on our server:

Example: Create a report of all service requests—ArcGIS Server | Documentation for ArcGIS Enterprise

The script worked great as it was.  But now I need to run it on a server that is configured for https only.  The script includes a comment:

serverPort = 6080 # assumes server is enabled for HTTP access, HTTPS only sites will require (minor) script changes

Changing "serverPort = 6443" does not work.  Has anyone modified this script to work with a server configured for https only?

Thanks,

Bernie.

0 Kudos
4 Replies
MikeVolz
Occasional Contributor

Could it be that https traffic is using a different port such as 443?

0 Kudos
ThomasHoman
Frequent Contributor

There are also 5 http:// calls that will need to be updated to https:// so make sure to update those along with the port number.

Just as a note - My 10.9.1 server still uses the self signed cert for the internal server and Python definitely does not like that. There are plenty of search results to disable Python TLS checking if you need to explore that avenue.

Hope this helps.

Tom

berniejconnors
Frequent Contributor

Thomas,

        I replaced the port number with 6443 and updated all of the http calls to https but I still get these errors - do you think this is the self signed cert that you mentioed?

Traceback (most recent call last):
File "C:\Temp\python_scripts\map_service_stats\mss.py", line 203, in <module>
sys.exit(main(sys.argv[1:]))
File "C:\Temp\python_scripts\map_service_stats\mss.py", line 56, in main
token = getToken(username, password, serverName, serverPort)
File "C:\Temp\python_scripts\map_service_stats\mss.py", line 183, in getToken
if not assertJsonSuccess(data):
File "C:\Temp\python_scripts\map_service_stats\mss.py", line 193, in assertJsonSuccess
obj = json.loads(data)
File "C:\Python27\ArcGIS10.7\lib\json\__init__.py", line 339, in loads
return _default_decoder.decode(s)
File "C:\Python27\ArcGIS10.7\lib\json\decoder.py", line 364, in decode
obj, end = self.raw_decode(s, idx=_w(s, 0).end())
File "C:\Python27\ArcGIS10.7\lib\json\decoder.py", line 382, in raw_decode
raise ValueError("No JSON object could be decoded")
ValueError: No JSON object could be decoded

Thanks,

Bernie.

0 Kudos
ThomasHoman
Frequent Contributor

Hi Berine,

It could be. When I ran it the self signed cert was very obvious in the last few lines of the traceback. I think I ran the code from the command prompt so there might have been more verbose error response in my running. c:\python27\... mss.py . I was looking at running it under task scheduler so thought I would go the command line router rather than a windowed interpreter. 

If you have web access to the server for administration do you have a valid certificate lock or a bad cert indicator showing self-signed?

Regards,

Tom

0 Kudos