Hi team,
I am working on portal.py. I am trying to get the details of SSL certficates which the portal is using.
I have tried with some code but nothing is working. Any suggestion on this will be helpful.
<SPAN class="keyword token">import</SPAN> sys
sys<SPAN class="punctuation token">.</SPAN>path<SPAN class="punctuation token">.</SPAN>append<SPAN class="punctuation token">(</SPAN><SPAN class="string token">'..'</SPAN><SPAN class="punctuation token">)</SPAN>
<SPAN class="keyword token">import</SPAN> portalpy
<SPAN class="keyword token">import</SPAN> csv
<SPAN class="keyword token">import</SPAN> ssl<SPAN class="punctuation token">,</SPAN> socket
portalUrl <SPAN class="operator token">=</SPAN> <SPAN class="string token"><SPAN>"</SPAN><A class="jive-link-external-small" href="https://community.esri.com/external-link.jspa?url=https%3A%2F%2Fxxx-xyz.xyz.xyz.com%3A7443%2Farcgis" target="_blank">https://xyz-xyz.xyz.xyz.com:7443/arcgis</A><SPAN>"</SPAN></SPAN>
portalAdminUser <SPAN class="operator token">=</SPAN> <SPAN class="string token">"xyz"</SPAN>
portalAdminPassword <SPAN class="operator token">=</SPAN> <SPAN class="string token">"xyz"</SPAN>
portal <SPAN class="operator token">=</SPAN> portalpy<SPAN class="punctuation token">.</SPAN>Portal<SPAN class="punctuation token">(</SPAN>portalUrl<SPAN class="punctuation token">,</SPAN> portalAdminUser<SPAN class="punctuation token">,</SPAN>portalAdminPassword<SPAN class="punctuation token">)</SPAN>
users <SPAN class="operator token">=</SPAN> portal<SPAN class="punctuation token">.</SPAN>search_users<SPAN class="punctuation token">(</SPAN><SPAN class="string token">'(role:account_admin OR role:account_publisher OR role:account_user)'</SPAN><SPAN class="punctuation token">)</SPAN>
activeUser <SPAN class="operator token">=</SPAN> portal<SPAN class="punctuation token">.</SPAN>logged_in_user<SPAN class="punctuation token">(</SPAN><SPAN class="punctuation token">)</SPAN>
<SPAN class="keyword token">print</SPAN> activeUser<SPAN class="punctuation token">[</SPAN><SPAN class="string token">'email'</SPAN><SPAN class="punctuation token">]</SPAN>
ctx <SPAN class="operator token">=</SPAN> ssl<SPAN class="punctuation token">.</SPAN>create_default_context<SPAN class="punctuation token">(</SPAN><SPAN class="punctuation token">)</SPAN>
s <SPAN class="operator token">=</SPAN> ctx<SPAN class="punctuation token">.</SPAN>wrap_socket<SPAN class="punctuation token">(</SPAN>socket<SPAN class="punctuation token">.</SPAN>socket<SPAN class="punctuation token">(</SPAN><SPAN class="punctuation token">)</SPAN><SPAN class="punctuation token">,</SPAN>server_hostname<SPAN class="operator token">=</SPAN><SPAN class="string token"><SPAN>'</SPAN><A class="jive-link-external-small" href="https://community.esri.com/external-link.jspa?url=http%3A%2F%2Fxxx-xyz.xyz.com%2Farcgis%2Fhome%2F" target="_blank">http://xyz-xyz.xyz.com/arcgis/home/</A><SPAN>'</SPAN></SPAN><SPAN class="punctuation token">)</SPAN>
s<SPAN class="punctuation token">.</SPAN>connect<SPAN class="punctuation token">(</SPAN><SPAN class="punctuation token">(</SPAN>portal<SPAN class="punctuation token">,</SPAN> <SPAN class="number token">443</SPAN><SPAN class="punctuation token">)</SPAN><SPAN class="punctuation token">)</SPAN>
cert <SPAN class="operator token">=</SPAN> s<SPAN class="punctuation token">.</SPAN>getpeercert<SPAN class="punctuation token">(</SPAN><SPAN class="punctuation token">)</SPAN>
<SPAN class="keyword token">print</SPAN> cert
<SPAN class="line-numbers-rows"><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN></SPAN>
<SPAN class="" style="color: #303336; border: 0px; font-size: 13px;"></SPAN>
Thanks
Aditya Kumar