<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: AttributeError: 'Server' object has no attribute 'services' in Python Questions</title>
    <link>https://community.esri.com/t5/python-questions/attributeerror-server-object-has-no-attribute/m-p/1109064#M62698</link>
    <description>&lt;P&gt;I have been able to recreate this issue with versions of the ArcGIS Python API from 1.8.2 to 1.9.1.&lt;/P&gt;&lt;P&gt;For anyone still having this issue, it seems it is caused when using a non-standard Portal Administrator account to connect with. There seems to be a way around by explicitly re-connecting using the 'portal_connection' optional argument as follows:&lt;/P&gt;&lt;LI-CODE lang="python"&gt;gis = GIS(portal_url, user_name, user_pass)

hosting_server_url = gis.admin.servers.get(role="HOSTING_SERVER")[0].url

hosting_server = Server(url=hosting_server_url,
                        portal_connection=gis)&lt;/LI-CODE&gt;&lt;P&gt;For some reason, the Server Object returned from gis.admin.servers.get() is a connection, but not a true Administrative connection. I was able to return the URL, but not many other properties.&lt;/P&gt;&lt;P&gt;Hope this helps someone.&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Tue, 19 Oct 2021 23:50:09 GMT</pubDate>
    <dc:creator>JoshuaWatson3</dc:creator>
    <dc:date>2021-10-19T23:50:09Z</dc:date>
    <item>
      <title>AttributeError: 'Server' object has no attribute 'services'</title>
      <link>https://community.esri.com/t5/python-questions/attributeerror-server-object-has-no-attribute/m-p/1072637#M61493</link>
      <description>&lt;P&gt;Greetings,&lt;/P&gt;&lt;P&gt;I used the ESRI Python code to get a list of Services. URL:&amp;nbsp;&lt;A href="https://developers.arcgis.com/python/api-reference/arcgis.gis.server.html" target="_blank" rel="noopener"&gt;arcgis.gis.server module — arcgis 1.8.5 documentation&lt;/A&gt;&lt;/P&gt;&lt;P&gt;Using the same code:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="python"&gt;gis = GIS(portalURL, username, password)
##print('Connected to {} as {}'.format(gis_name.properties.portalHostname, gis_name.users.me.username))

print("Logged IN")
#print(gis.admin.servers.validate())  ### true
gis_server = gis.admin.servers.list()
print(gis_server)
server1 = gis_server[0]
services = server1.services.list()
print(services)&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The server name is returned, throws an error on the following line:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="python"&gt;services = server1.services.list()&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Error message:&lt;/P&gt;&lt;P&gt;Traceback (most recent call last):&lt;BR /&gt;File "C:/Users/tmpgcesn/PycharmProjects/TEST/venv/Test/LOGS_Internal.py", line 31, in &amp;lt;module&amp;gt;&lt;BR /&gt;services = server1.services.list()&lt;BR /&gt;File "C:\Program Files\ArcGIS\Pro\bin\Python\envs\arcgispro-py3\lib\site-packages\arcgis\gis\server\_common\_base.py", line 86, in __getattr__&lt;BR /&gt;raise AttributeError("'%s' object has no attribute '%s'" % (type(self).__name__, name))&lt;BR /&gt;AttributeError: 'Server' object has no attribute 'services'&lt;/P&gt;&lt;P&gt;Process finished with exit code 1&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Has anyone resolved this issue?? Or can point to any suggestions?&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Clive&lt;/P&gt;</description>
      <pubDate>Fri, 25 Jun 2021 15:36:13 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/attributeerror-server-object-has-no-attribute/m-p/1072637#M61493</guid>
      <dc:creator>CliveSwan</dc:creator>
      <dc:date>2021-06-25T15:36:13Z</dc:date>
    </item>
    <item>
      <title>Re: AttributeError: 'Server' object has no attribute 'services'</title>
      <link>https://community.esri.com/t5/python-questions/attributeerror-server-object-has-no-attribute/m-p/1072767#M61495</link>
      <description>&lt;P&gt;&lt;A href="https://community.esri.com/t5/arcgis-api-for-python-questions/attributeerror-servicemanager-object-has-no-attribute-services/td-p/858509" target="_blank"&gt;AttributeError: 'ServiceManager' object has no att... - Esri Community&lt;/A&gt;&lt;/P&gt;&lt;P&gt;there are a number of similar errors, none of which were answered and it has been going on over several versions...&lt;/P&gt;&lt;P&gt;It was reported and apparently fixed.... go figure&lt;/P&gt;&lt;P&gt;&lt;A href="https://support.esri.com/en/bugs/nimbus/QlVHLTAwMDEzNjU3Nw==" target="_blank"&gt;BUG-000136577: When using the services.list() function, the followi.. (esri.com)&lt;/A&gt;&lt;/P&gt;&lt;P&gt;You might want to post an "Issue" on their github site&lt;/P&gt;&lt;P&gt;&lt;A href="https://github.com/Esri/arcgis-python-api" target="_blank"&gt;Esri/arcgis-python-api: Documentation and samples for ArcGIS API for Python (github.com)&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 25 Jun 2021 19:42:57 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/attributeerror-server-object-has-no-attribute/m-p/1072767#M61495</guid>
      <dc:creator>DanPatterson</dc:creator>
      <dc:date>2021-06-25T19:42:57Z</dc:date>
    </item>
    <item>
      <title>Re: AttributeError: 'Server' object has no attribute 'services'</title>
      <link>https://community.esri.com/t5/python-questions/attributeerror-server-object-has-no-attribute/m-p/1073666#M61516</link>
      <description>&lt;P&gt;Hi Dan,&lt;/P&gt;&lt;P&gt;Thanks for the message.&lt;/P&gt;&lt;P&gt;I read the link in your message, the answer is:&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;From ESRI Upgrade to ArcGIS Pro 2.7 - arcgis module 1.8.3.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;I have ArcGIS Pro 2.7.2 installed, with arcgis module 1.8.3...&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;It still doesn't work...&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 29 Jun 2021 14:03:36 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/attributeerror-server-object-has-no-attribute/m-p/1073666#M61516</guid>
      <dc:creator>CliveSwan</dc:creator>
      <dc:date>2021-06-29T14:03:36Z</dc:date>
    </item>
    <item>
      <title>Re: AttributeError: 'Server' object has no attribute 'services'</title>
      <link>https://community.esri.com/t5/python-questions/attributeerror-server-object-has-no-attribute/m-p/1073676#M61517</link>
      <description>&lt;P&gt;confused as to why your answer is marked correct then.&lt;/P&gt;&lt;P&gt;perhaps upgrade to Pro 2.8 and arcgis 1.8.5&lt;/P&gt;</description>
      <pubDate>Tue, 29 Jun 2021 14:16:52 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/attributeerror-server-object-has-no-attribute/m-p/1073676#M61517</guid>
      <dc:creator>DanPatterson</dc:creator>
      <dc:date>2021-06-29T14:16:52Z</dc:date>
    </item>
    <item>
      <title>Re: AttributeError: 'Server' object has no attribute 'services'</title>
      <link>https://community.esri.com/t5/python-questions/attributeerror-server-object-has-no-attribute/m-p/1100615#M62529</link>
      <description>&lt;P&gt;In my case I was getting this error when 2 of my arcgis server machines federated with the portal were shutdown.&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Cheers,&lt;/P&gt;&lt;P&gt;Neil&lt;/P&gt;</description>
      <pubDate>Wed, 22 Sep 2021 03:02:34 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/attributeerror-server-object-has-no-attribute/m-p/1100615#M62529</guid>
      <dc:creator>NeilEtheridge</dc:creator>
      <dc:date>2021-09-22T03:02:34Z</dc:date>
    </item>
    <item>
      <title>Re: AttributeError: 'Server' object has no attribute 'services'</title>
      <link>https://community.esri.com/t5/python-questions/attributeerror-server-object-has-no-attribute/m-p/1109064#M62698</link>
      <description>&lt;P&gt;I have been able to recreate this issue with versions of the ArcGIS Python API from 1.8.2 to 1.9.1.&lt;/P&gt;&lt;P&gt;For anyone still having this issue, it seems it is caused when using a non-standard Portal Administrator account to connect with. There seems to be a way around by explicitly re-connecting using the 'portal_connection' optional argument as follows:&lt;/P&gt;&lt;LI-CODE lang="python"&gt;gis = GIS(portal_url, user_name, user_pass)

hosting_server_url = gis.admin.servers.get(role="HOSTING_SERVER")[0].url

hosting_server = Server(url=hosting_server_url,
                        portal_connection=gis)&lt;/LI-CODE&gt;&lt;P&gt;For some reason, the Server Object returned from gis.admin.servers.get() is a connection, but not a true Administrative connection. I was able to return the URL, but not many other properties.&lt;/P&gt;&lt;P&gt;Hope this helps someone.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 19 Oct 2021 23:50:09 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/attributeerror-server-object-has-no-attribute/m-p/1109064#M62698</guid>
      <dc:creator>JoshuaWatson3</dc:creator>
      <dc:date>2021-10-19T23:50:09Z</dc:date>
    </item>
    <item>
      <title>Re: AttributeError: 'Server' object has no attribute 'services'</title>
      <link>https://community.esri.com/t5/python-questions/attributeerror-server-object-has-no-attribute/m-p/1122551#M63131</link>
      <description>&lt;P&gt;For some reason the 2 steps for setting the hosting_server you have didn't work for me.&amp;nbsp; BUT, finally figured out how to get it to work and why the old code doesn't work anymore.&amp;nbsp; I'm at 1.9.1 now.&amp;nbsp;&lt;/P&gt;&lt;P&gt;At some point it changed from being able to use the Server object to having to use the ServerManager for federated sites to get the ability to use the list() on services.&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P&gt;So instead of&amp;nbsp; the old:&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="c"&gt;gis = GIS(portal_url, user_name, user_pass)
gis_servers = gis.admin.servers.list()
server1 = gis_servers[0]&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;It changed to&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="python"&gt;gis = GIS(portal_url, user_name, user_pass)
server1 = gis.admin.servers.get(role="HOSTING_SERVER")[0]   
#note, don't use the .url as that is only a url reference versus the object, but definately use the [0] which isn't in the help as otherwise its just a list.  And this is the object so you don't need another line to get it.&lt;/LI-CODE&gt;&lt;P&gt;Finally all my start/stop, response time queries, and other scripts are working again!&amp;nbsp;&lt;/P&gt;&lt;P&gt;References:&lt;/P&gt;&lt;P&gt;&lt;A href="https://developers.arcgis.com/python/api-reference/arcgis.gis.server.html#server" target="_blank"&gt;https://developers.arcgis.com/python/api-reference/arcgis.gis.server.html#server&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;A href="https://developers.arcgis.com/python/api-reference/arcgis.gis.server.html#arcgis.gis.server.ServerManager.list" target="_blank"&gt;https://developers.arcgis.com/python/api-reference/arcgis.gis.server.html#arcgis.gis.server.ServerManager.list&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 03 Dec 2021 16:11:03 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/attributeerror-server-object-has-no-attribute/m-p/1122551#M63131</guid>
      <dc:creator>RobertO_Donnell</dc:creator>
      <dc:date>2021-12-03T16:11:03Z</dc:date>
    </item>
    <item>
      <title>Re: AttributeError: 'Server' object has no attribute 'services'</title>
      <link>https://community.esri.com/t5/python-questions/attributeerror-server-object-has-no-attribute/m-p/1585067#M73741</link>
      <description>&lt;P&gt;Incredibly helpful&amp;nbsp;&lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/14635"&gt;@RobertO_Donnell&lt;/a&gt;&amp;nbsp;, thank you!! I never would have cracked my code if not for this hidden tid bit!&lt;/P&gt;</description>
      <pubDate>Thu, 13 Feb 2025 18:05:52 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/attributeerror-server-object-has-no-attribute/m-p/1585067#M73741</guid>
      <dc:creator>AndreaB_</dc:creator>
      <dc:date>2025-02-13T18:05:52Z</dc:date>
    </item>
  </channel>
</rss>

