<?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: ISE Guest creation using Python script in Network Access Control</title>
    <link>https://community.cisco.com/t5/network-access-control/ise-guest-creation-using-python-script/m-p/4396717#M567061</link>
    <description>&lt;P&gt;I don't know what I am checking since you have not explained anything.&lt;/P&gt;
&lt;P&gt;You have not stated what you are trying to do or what the error is.&lt;/P&gt;
&lt;P&gt;I cannot copy and paste and run it from a PNG file.&lt;/P&gt;
&lt;P&gt;Please read &lt;STRONG&gt;&lt;A href="https://community.cisco.com/t5/security-documents/how-to-ask-the-community-for-help/ta-p/3704356" target="_blank" rel="noopener"&gt;How to Ask the Community for Help&lt;/A&gt;&lt;/STRONG&gt;.&lt;/P&gt;</description>
    <pubDate>Sun, 02 May 2021 14:42:50 GMT</pubDate>
    <dc:creator>thomas</dc:creator>
    <dc:date>2021-05-02T14:42:50Z</dc:date>
    <item>
      <title>ISE Guest creation using Python script</title>
      <link>https://community.cisco.com/t5/network-access-control/ise-guest-creation-using-python-script/m-p/4093760#M560752</link>
      <description>&lt;P&gt;Hi All,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I would like to create guest users using Python script.&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;I have installed 3.8.3 Python and saved the .py file and run the execution using ERS SDK guide for ISE&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;However getting an error:-&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;GAGSING3-M-93JT:Desktop gagsing3$ python3 &lt;A href="http://guestcreat.py" target="_blank" rel="noopener"&gt;guestcreat.py&amp;nbsp;&lt;/A&gt;&lt;A href="http://10.201.232.126" target="_blank" rel="noopener"&gt;10.x.x.x&lt;/A&gt; test Team@aaa1 2c380122-ec89-11e4-92cc-005056b46759 chris Chris Colombus Password1 &lt;U&gt;&lt;A href="mailto:chris@cisco.com" target="_blank" rel="noopener"&gt;chris@cisco.com&lt;/A&gt;&lt;/U&gt;&amp;nbsp; 90 05/25/2020 14:00 08/23/2020 14:00&lt;BR /&gt;&amp;nbsp;&lt;BR /&gt;Status: 400&lt;BR /&gt;Header:&lt;BR /&gt;Set-Cookie: JSESSIONIDSSO=C341793060C1D013AF22DD6D51C03225; Path=/; Secure; HttpOnly&lt;BR /&gt;Set-Cookie: APPSESSIONID=0E87BEF5BBD9F2DAB6943C4F3D281883; Path=/ers; Secure; HttpOnly&lt;BR /&gt;Cache-Control: no-cache, no-store, must-revalidate&lt;BR /&gt;Pragma: no-cache&lt;BR /&gt;Expires: Thu, 01 Jan 1970 00:00:00 GMT&lt;BR /&gt;Date: Mon, 25 May 2020 23:52:14 GMT&lt;BR /&gt;Content-Type: application/json;charset=utf-8&lt;BR /&gt;Content-Length: 384&lt;BR /&gt;Connection: close&lt;BR /&gt;Server:&amp;nbsp;&lt;BR /&gt;&amp;nbsp;&lt;BR /&gt;&amp;nbsp;&lt;BR /&gt;Body:&lt;BR /&gt;{&lt;BR /&gt;&amp;nbsp; "ERSResponse" : {&lt;BR /&gt;&amp;nbsp; &amp;nbsp; "operation" : "POST-create-guestuser",&lt;BR /&gt;&amp;nbsp; &amp;nbsp; "messages" : [ {&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;STRONG&gt;"title" : "Resource Initialization Failed(10)",&lt;/STRONG&gt;&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; "type" : "ERROR",&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; "code" : &lt;STRONG&gt;"Application resource validation exception&lt;/STRONG&gt;"&lt;BR /&gt;&amp;nbsp; &amp;nbsp; } ],&lt;BR /&gt;&amp;nbsp; &amp;nbsp; "link" : {&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; "rel" : "related",&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; "href" : "&lt;U&gt;&lt;A href="https://10.201.232.126:9060/ers/config/guestuser/" target="_blank" rel="noopener"&gt;https://10.x.x.x:9060/ers/config/guestuser/&lt;/A&gt;&lt;/U&gt;",&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; "type" : "application/xml"&lt;BR /&gt;&amp;nbsp; &amp;nbsp; }&lt;BR /&gt;&amp;nbsp; }&lt;BR /&gt;}&lt;BR /&gt;GAGSING3-M-93JT:Desktop gagsing3$&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;&amp;nbsp;Any help would be appreciated!!!&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;Regards&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;Gagandeep Singh&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 28 May 2020 16:34:34 GMT</pubDate>
      <guid>https://community.cisco.com/t5/network-access-control/ise-guest-creation-using-python-script/m-p/4093760#M560752</guid>
      <dc:creator>Gagandeep Singh</dc:creator>
      <dc:date>2020-05-28T16:34:34Z</dc:date>
    </item>
    <item>
      <title>Re: ISE Guest creation using Python script</title>
      <link>https://community.cisco.com/t5/network-access-control/ise-guest-creation-using-python-script/m-p/4093840#M560753</link>
      <description>&lt;P&gt;You did not include your Python code or actual REST input (JSON or XML) to ISE so hard to compare with the ERS documentation or run your code independently and debug / troubleshoot.&lt;/P&gt;
&lt;P&gt;&lt;A href="https://community.cisco.com/t5/security-documents/ise-ers-api-examples/ta-p/3622623" target="_self"&gt;ISE ERS API Examples&lt;/A&gt; points to &lt;A href="https://community.cisco.com/docs/DOC-71891" target="_blank" rel="noopener"&gt;Guest &amp;amp; Sponsor API&lt;/A&gt; which has sections&lt;/P&gt;
&lt;UL&gt;
&lt;LI style="list-style-type: disc; margin-left: 15px; margin-bottom: 1px;"&gt;&lt;A href="https://community.cisco.com/t5/security-documents/ise-guest-sponsor-api-tips-amp-tricks/ta-p/3636773#toc-hId--1651113274" target="_blank" rel="nofollow noopener noreferrer"&gt;Create Guest User&lt;/A&gt;&lt;/LI&gt;
&lt;LI style="list-style-type: disc; margin-left: 15px; margin-bottom: 1px;"&gt;&lt;A href="https://community.cisco.com/t5/security-documents/ise-guest-sponsor-api-tips-amp-tricks/ta-p/3636773#toc-hId-836399559" target="_blank" rel="nofollow noopener noreferrer"&gt;Creating user without username and password&lt;/A&gt;&lt;/LI&gt;
&lt;/UL&gt;
&lt;P&gt;using both XML and JSON for comparison.&lt;/P&gt;
&lt;P&gt;I did this on my setup...&lt;/P&gt;
&lt;P&gt;Follow the instructions @ &lt;A href="https://community.cisco.com/docs/DOC-71891" target="_blank" rel="noopener"&gt;Guest &amp;amp; Sponsor API&lt;/A&gt; for&lt;/P&gt;
&lt;OL&gt;
&lt;LI&gt;&lt;A href="https://community.cisco.com/t5/security-documents/ise-guest-sponsor-api-tips-amp-tricks/ta-p/3636773#toc-hId-1174198255" target="_blank" rel="nofollow noopener noreferrer"&gt;Access Permissions&lt;/A&gt;&lt;/LI&gt;
&lt;LI&gt;&lt;A href="https://community.cisco.com/t5/security-documents/ise-guest-sponsor-api-tips-amp-tricks/ta-p/3636773#toc-hId-1864759729" target="_blank" rel="nofollow noopener noreferrer"&gt;Give Sponsor group access to the API&lt;/A&gt;&lt;/LI&gt;
&lt;/OL&gt;
&lt;P&gt;Find my Sponsor Portal ID:&lt;/P&gt;
&lt;PRE&gt;curl -k --include --header 'Content-Type:application/json' --header 'Accept: application/json' --user admin:C1sco12345 https://198.18.133.27:9060/ers/config/portal&lt;/PRE&gt;
&lt;P&gt;which gave me (edited for brevity) :&lt;/P&gt;
&lt;PRE&gt;&lt;STRONG&gt;"id" : "b7e7d773-7bb3-442b-a50b-42837c12248a", "name" : "Sponsor Portal (default)",&lt;/STRONG&gt;&lt;BR /&gt;"id" : "deaaa863-1df0-4198-baf1-8d5b690d4361", "name" : "Self-Registered Guest Portal (default)",&lt;BR /&gt;"id" : "50fbc805-6bde-4e28-8a3e-17750f938538", "name" : "Sponsored Guest Portal (default)",&lt;BR /&gt;"id" : "f9b94c2f-a3fc-4154-acbb-d4c4fbed899d", "name" : "Hotspot Guest Portal (default)",&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;So I put that together in a JSON POST request using cURL with a mix of your settings with changes to match my environment (portal ID, minimum password complexity, future date/times) and please note the use of &lt;FONT face="courier new,courier"&gt;sponsor-api&lt;/FONT&gt; as the user to configure the guest user via API as explained in &lt;A href="https://community.cisco.com/docs/DOC-71891" target="_blank" rel="noopener"&gt;Guest &amp;amp; Sponsor API&lt;/A&gt; :&lt;/P&gt;
&lt;PRE&gt;curl -k --include --header 'Content-Type:application/json' --header 'Accept: application/json' &lt;STRONG&gt;--user sponsor-api:C1sco12345&lt;/STRONG&gt; --request POST https://198.18.133.27:9060/ers/config/guestuser --data '&lt;BR /&gt;{&lt;BR /&gt;  "GuestUser": {&lt;BR /&gt;    "name": "chris",&lt;BR /&gt;    "guestType": "Contractor (default)",&lt;BR /&gt;    "portalId": "b7e7d773-7bb3-442b-a50b-42837c12248a",&lt;BR /&gt;    "guestInfo": {&lt;BR /&gt;      "userName": "chris",&lt;BR /&gt;      "emailAddress": "chris@cisco.com",&lt;BR /&gt;      "password": "Password1234",&lt;BR /&gt;      "enabled": true&lt;BR /&gt;    },&lt;BR /&gt;    "guestAccessInfo": {&lt;BR /&gt;      "validDays": 90,&lt;BR /&gt;      "fromDate": "05/29/2020 14:00",&lt;BR /&gt;      "toDate": "08/27/2020 14:00",&lt;BR /&gt;      "location": "San Jose"&lt;BR /&gt;    },&lt;BR /&gt;    "customFields": {}&lt;BR /&gt;  }&lt;BR /&gt;}'&lt;BR /&gt;HTTP/1.1 201&lt;BR /&gt;Set-Cookie: JSESSIONIDSSO=D3A42162BB80C0C73A135DD1E1755191; Path=/; Secure; HttpOnly&lt;BR /&gt;Set-Cookie: APPSESSIONID=4C8376ECD638954B2D619279A4E325DE; Path=/ers; Secure; HttpOnly&lt;BR /&gt;Cache-Control: no-cache, no-store, must-revalidate&lt;BR /&gt;Pragma: no-cache&lt;BR /&gt;Expires: Thu, 01 Jan 1970 00:00:00 GMT&lt;BR /&gt;X-Frame-Options: SAMEORIGIN&lt;BR /&gt;Strict-Transport-Security: max-age=31536000; includeSubDomains&lt;BR /&gt;X-Content-Type-Options: nosniff&lt;BR /&gt;X-Content-Security-Policy: default-src 'self'; script-src 'self' 'unsafe-inline' 'unsafe-eval'; style-src 'self' 'unsafe-inline'; img-src 'self' data:;&lt;BR /&gt;X-WebKit-CSP: default-src 'self'; script-src 'self' 'unsafe-inline' 'unsafe-eval'; style-src 'self' 'unsafe-inline'; img-src 'self' data:;&lt;BR /&gt;Content-Security-Policy: default-src 'self'; script-src 'self' 'unsafe-inline' 'unsafe-eval'; style-src 'self' 'unsafe-inline'; img-src 'self' data:;&lt;BR /&gt;X-XSS-Protection: 1; mode=block&lt;BR /&gt;&lt;STRONG&gt;Location: https://198.18.133.27:9060/ers/config/guestuser/bdc8287e-4fd2-492a-b21f-8feecb638749&lt;/STRONG&gt;&lt;BR /&gt;Date: Thu, 28 May 2020 18:34:34 GMT&lt;BR /&gt;Content-Type: application/json;charset=utf-8&lt;BR /&gt;Content-Length: 0&lt;BR /&gt;Server&lt;/PRE&gt;
&lt;P&gt;It worked, returning the &lt;FONT face="courier new,courier"&gt;Location&lt;/FONT&gt; field resource for my new Guest User :&lt;/P&gt;
&lt;PRE&gt;curl -k --include --header 'Content-Type:application/json' --header 'Accept: application/json' &lt;STRONG&gt;--user sponsor-api:C1sco12345&lt;/STRONG&gt; --request GET https://198.18.133.27:9060/ers/config/guestuser/bdc8287e-4fd2-492a-b21f-8feecb638749&lt;BR /&gt;{&lt;BR /&gt;"GuestUser" : {&lt;BR /&gt;"id" : "bdc8287e-4fd2-492a-b21f-8feecb638749",&lt;BR /&gt;"name" : "chris",&lt;BR /&gt;"guestType" : "Contractor (default)",&lt;BR /&gt;"status" : "AWAITING_INITIAL_LOGIN",&lt;BR /&gt;"sponsorUserName" : "sponsor-api",&lt;BR /&gt;"sponsorUserId" : "2ef8ec82-dfc4-4fda-81be-4475c294d923",&lt;BR /&gt;"guestInfo" : {&lt;BR /&gt;"userName" : "chris",&lt;BR /&gt;"emailAddress" : "chris@cisco.com",&lt;BR /&gt;"password" : "Password1234",&lt;BR /&gt;"creationTime" : "05/28/2020 11:34",&lt;BR /&gt;"enabled" : false,&lt;BR /&gt;"notificationLanguage" : "English"&lt;BR /&gt;},&lt;BR /&gt;"guestAccessInfo" : {&lt;BR /&gt;"validDays" : 90,&lt;BR /&gt;"fromDate" : "05/29/2020 14:00",&lt;BR /&gt;"toDate" : "08/27/2020 14:00",&lt;BR /&gt;"location" : "San Jose"&lt;BR /&gt;},&lt;BR /&gt;"customFields" : { },&lt;BR /&gt;"link" : {&lt;BR /&gt;"rel" : "self",&lt;BR /&gt;"href" : "https://198.18.133.27:9060/ers/config/guestuser/bdc8287e-4fd2-492a-b21f-8feecb638749",&lt;BR /&gt;"type" : "application/json"&lt;BR /&gt;}&lt;BR /&gt;}&lt;BR /&gt;}&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 28 May 2020 18:55:30 GMT</pubDate>
      <guid>https://community.cisco.com/t5/network-access-control/ise-guest-creation-using-python-script/m-p/4093840#M560753</guid>
      <dc:creator>thomas</dc:creator>
      <dc:date>2020-05-28T18:55:30Z</dc:date>
    </item>
    <item>
      <title>Re: ISE Guest creation using Python script</title>
      <link>https://community.cisco.com/t5/network-access-control/ise-guest-creation-using-python-script/m-p/4093844#M560754</link>
      <description>&lt;P&gt;Thanks Thomas for helping on this request.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Script as below:-&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;#!/usr/bin/env python&lt;/P&gt;
&lt;P&gt;###########################################################################&lt;BR /&gt;# #&lt;BR /&gt;# This script demonstrates how to create guest user through ISE ERS Guest #&lt;BR /&gt;# users API by executing a Python script. #&lt;BR /&gt;# #&lt;BR /&gt;# SECURITY WARNING - DO NOT USE THIS SCRIPT IN PRODUCTION! #&lt;BR /&gt;# The script allows connections to SSL sites without trusting #&lt;BR /&gt;# the server certificates. #&lt;BR /&gt;# For production, it is required to add certificate check. #&lt;BR /&gt;# #&lt;BR /&gt;# Usage: create-guest-user.py &amp;lt;ISE host&amp;gt;&amp;lt;Sponsor user&amp;gt;&amp;lt;Sponsor password&amp;gt; #&lt;BR /&gt;# &amp;lt;portalId&amp;gt;&amp;lt;username&amp;gt;&amp;lt;firstName&amp;gt;&amp;lt;lastName&amp;gt;&amp;lt;password&amp;gt;&amp;lt;email&amp;gt;&amp;lt;validDays&amp;gt; #&lt;BR /&gt;# &amp;lt;fromDate&amp;gt;&amp;lt;toDate&amp;gt; #&lt;BR /&gt;###########################################################################&lt;/P&gt;
&lt;P&gt;import http.client&lt;BR /&gt;import base64&lt;BR /&gt;import ssl&lt;BR /&gt;import sys&lt;/P&gt;
&lt;P&gt;#parameters&lt;BR /&gt;portalId = sys.argv[4] # "2c380122-ec89-11e4-92cc-005056b46759"&lt;BR /&gt;userName = sys.argv[5] # "chris"&lt;BR /&gt;firstName = sys.argv[6] # "Chris"&lt;BR /&gt;lastName = sys.argv[7] # "Colombus"&lt;BR /&gt;password = sys.argv[8] # "Password1"&lt;BR /&gt;emailAddress = sys.argv[9] # "chris@cisco.com"&lt;BR /&gt;validDays = sys.argv[10] # "90"&lt;BR /&gt;fromDate = sys.argv[11] # “05/25/2020”&lt;BR /&gt;toDate = sys.argv[12] # "08/23/2020”&lt;/P&gt;
&lt;P&gt;# host and authentication credentials&lt;BR /&gt;host = sys.argv[1] # "10.201”.232.126&lt;BR /&gt;user = sys.argv[2] # “test” &lt;BR /&gt;password = sys.argv[3] # “Team@aaa1”&lt;/P&gt;
&lt;P&gt;&lt;BR /&gt;conn = http.client.HTTPSConnection("{}:9060".format(host), context=ssl.SSLContext(ssl.PROTOCOL_TLS))&lt;/P&gt;
&lt;P&gt;creds = str.encode(':'.join((user, password)))&lt;BR /&gt;encodedAuth = bytes.decode(base64.b64encode(creds))&lt;/P&gt;
&lt;P&gt;req_body_json = """ {{&lt;BR /&gt;"GuestUser" : {{&lt;BR /&gt;"guestType": "Contractor (default)",&lt;BR /&gt;"reasonForVisit": "Business meetng",&lt;BR /&gt;"portalId": "{}",&lt;BR /&gt;"guestInfo" : {{&lt;BR /&gt;"userName": "{}",&lt;BR /&gt;"firstName": "{}",&lt;BR /&gt;"lastName": "{}",&lt;BR /&gt;"password": "{}",&lt;BR /&gt;"emailAddress": "{}",&lt;BR /&gt;"enabled": true,&lt;BR /&gt;"notificationLanguage": "English",&lt;BR /&gt;"smsServiceProvider": "Global Default"&lt;BR /&gt;}},&lt;BR /&gt;"guestAccessInfo" : {{&lt;BR /&gt;"validDays": "{}",&lt;BR /&gt;"fromDate": "{}",&lt;BR /&gt;"toDate": "{}",&lt;BR /&gt;"location": "San Jose"&lt;BR /&gt;}}&lt;BR /&gt;}}&lt;BR /&gt;}}&lt;BR /&gt;""".format(portalId,userName,firstName,lastName,password,emailAddress,validDays,fromDate,toDate)&lt;/P&gt;
&lt;P&gt;headers = {&lt;BR /&gt;'accept': "application/json",&lt;BR /&gt;'content-type': "application/json",&lt;BR /&gt;'authorization': " ".join(("Basic",encodedAuth)),&lt;BR /&gt;'cache-control': "no-cache",&lt;BR /&gt;}&lt;/P&gt;
&lt;P&gt;conn.request("POST", "/ers/config/guestuser/", headers=headers, body=req_body_json)&lt;/P&gt;
&lt;P&gt;res = conn.getresponse()&lt;BR /&gt;data = res.read()&lt;/P&gt;
&lt;P&gt;print("Status: {}".format(res.status))&lt;BR /&gt;print("Header:\n{}".format(res.headers))&lt;BR /&gt;print("Body:\n{}".format(data.decode("utf-8")))&lt;/P&gt;</description>
      <pubDate>Thu, 28 May 2020 18:52:06 GMT</pubDate>
      <guid>https://community.cisco.com/t5/network-access-control/ise-guest-creation-using-python-script/m-p/4093844#M560754</guid>
      <dc:creator>Gagandeep Singh</dc:creator>
      <dc:date>2020-05-28T18:52:06Z</dc:date>
    </item>
    <item>
      <title>Re: ISE Guest creation using Python script</title>
      <link>https://community.cisco.com/t5/network-access-control/ise-guest-creation-using-python-script/m-p/4093848#M560755</link>
      <description>&lt;P&gt;Added some basic print statements to see your JSON request body...&lt;/P&gt;
&lt;PRE&gt;print('-'*80)&lt;BR /&gt;print(req_body_json)&lt;BR /&gt;print('-'*80)&lt;/PRE&gt;
&lt;P&gt;and it revealed&lt;/P&gt;
&lt;PRE&gt;--------------------------------------------------------------------------------&lt;BR /&gt;{&lt;BR /&gt;"GuestUser" : {&lt;BR /&gt;"guestType": "Contractor (default)",&lt;BR /&gt;"reasonForVisit": "Business meetng",&lt;BR /&gt;"portalId": "b7e7d773-7bb3-442b-a50b-42837c12248a",&lt;BR /&gt;"guestInfo" : {&lt;BR /&gt;"userName": "chris",&lt;BR /&gt;"firstName": "Chris",&lt;BR /&gt;"lastName": "Colombus",&lt;BR /&gt;"password": "C1sco12345",&lt;BR /&gt;"emailAddress": "chris@cisco.com",&lt;BR /&gt;"enabled": true,&lt;BR /&gt;"notificationLanguage": "English",&lt;BR /&gt;"smsServiceProvider": "Global Default"&lt;BR /&gt;},&lt;BR /&gt;"guestAccessInfo" : {&lt;BR /&gt;"validDays": "90",&lt;BR /&gt;&lt;FONT color="#FF0000"&gt;&lt;STRONG&gt;"fromDate": "05/25/2020",&lt;/STRONG&gt;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#FF0000"&gt;&lt;STRONG&gt;"toDate": "14:00",&lt;/STRONG&gt;&lt;/FONT&gt;&lt;BR /&gt;"location": "San Jose"&lt;BR /&gt;}&lt;BR /&gt;}&lt;BR /&gt;}&lt;BR /&gt;--------------------------------------------------------------------------------&lt;/PRE&gt;
&lt;P&gt;and it looks like you are not parsing your From/To Dates properly because you forgot to account for the Time as separate arguments on the CLI.&lt;/P&gt;
&lt;P&gt;Use this instead:&lt;/P&gt;
&lt;PRE&gt;fromDate = f'{sys.argv[11]} {sys.argv[12]}' # "05/25/2020"&lt;BR /&gt;toDate = f'{sys.argv[13]} {sys.argv[14]}' # "08/23/2020"&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 28 May 2020 19:11:53 GMT</pubDate>
      <guid>https://community.cisco.com/t5/network-access-control/ise-guest-creation-using-python-script/m-p/4093848#M560755</guid>
      <dc:creator>thomas</dc:creator>
      <dc:date>2020-05-28T19:11:53Z</dc:date>
    </item>
    <item>
      <title>Re: ISE Guest creation using Python script</title>
      <link>https://community.cisco.com/t5/network-access-control/ise-guest-creation-using-python-script/m-p/4093866#M560756</link>
      <description>&lt;P&gt;Thanks Thomas. It worked for me &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 28 May 2020 19:42:08 GMT</pubDate>
      <guid>https://community.cisco.com/t5/network-access-control/ise-guest-creation-using-python-script/m-p/4093866#M560756</guid>
      <dc:creator>Gagandeep Singh</dc:creator>
      <dc:date>2020-05-28T19:42:08Z</dc:date>
    </item>
    <item>
      <title>Re: ISE Guest creation using Python script</title>
      <link>https://community.cisco.com/t5/network-access-control/ise-guest-creation-using-python-script/m-p/4396566#M567052</link>
      <description>&lt;P&gt;&lt;a href="https://community.cisco.com/t5/user/viewprofilepage/user-id/26555"&gt;@thomas&lt;/a&gt;&amp;nbsp;Hi&amp;nbsp; Thomas&amp;nbsp;&lt;/P&gt;&lt;P&gt;I was trying to use the same code to create internal user instead of guest user&amp;nbsp;&lt;/P&gt;&lt;P&gt;This is my code and the error I got while i run it&amp;nbsp; . can you help me out&lt;/P&gt;</description>
      <pubDate>Sat, 01 May 2021 18:19:21 GMT</pubDate>
      <guid>https://community.cisco.com/t5/network-access-control/ise-guest-creation-using-python-script/m-p/4396566#M567052</guid>
      <dc:creator>RichardAcolatse8417</dc:creator>
      <dc:date>2021-05-01T18:19:21Z</dc:date>
    </item>
    <item>
      <title>Re: ISE Guest creation using Python script</title>
      <link>https://community.cisco.com/t5/network-access-control/ise-guest-creation-using-python-script/m-p/4396584#M567054</link>
      <description>&lt;P&gt;Sorry, I'm not going to open random zip file attachments for security reasons. 8-)&lt;/P&gt;
&lt;P&gt;From the attached image it appears that you are trying to run Python with "&lt;FONT face="courier new,courier"&gt;py&lt;/FONT&gt;" and not "&lt;FONT face="courier new,courier"&gt;python.exe&lt;/FONT&gt;" which is why windows &lt;EM&gt;cannot find the file&lt;/EM&gt;. Cisco DevNet has an excellent video series on &lt;A href="https://developer.cisco.com/video/net-prog-basics/" target="_self" rel="nofollow noopener noreferrer"&gt;Network Programmability Basics&lt;/A&gt; - specifically the &lt;A href="https://developer.cisco.com/video/net-prog-basics/01-programming_fundamentals" target="_self" rel="nofollow noopener noreferrer"&gt;Programming Fundamentals&lt;/A&gt; module gives you the background on using Python.&lt;/P&gt;
&lt;P&gt;Please submit any additional questions as a new thread in the community with our specific issue.&lt;/P&gt;</description>
      <pubDate>Sat, 01 May 2021 20:32:06 GMT</pubDate>
      <guid>https://community.cisco.com/t5/network-access-control/ise-guest-creation-using-python-script/m-p/4396584#M567054</guid>
      <dc:creator>thomas</dc:creator>
      <dc:date>2021-05-01T20:32:06Z</dc:date>
    </item>
    <item>
      <title>Re: ISE Guest creation using Python script</title>
      <link>https://community.cisco.com/t5/network-access-control/ise-guest-creation-using-python-script/m-p/4396591#M567056</link>
      <description>&lt;P&gt;OK . thank you&amp;nbsp; for&amp;nbsp; assistance . Can you check this last one&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 01 May 2021 21:28:01 GMT</pubDate>
      <guid>https://community.cisco.com/t5/network-access-control/ise-guest-creation-using-python-script/m-p/4396591#M567056</guid>
      <dc:creator>RichardAcolatse8417</dc:creator>
      <dc:date>2021-05-01T21:28:01Z</dc:date>
    </item>
    <item>
      <title>Re: ISE Guest creation using Python script</title>
      <link>https://community.cisco.com/t5/network-access-control/ise-guest-creation-using-python-script/m-p/4396717#M567061</link>
      <description>&lt;P&gt;I don't know what I am checking since you have not explained anything.&lt;/P&gt;
&lt;P&gt;You have not stated what you are trying to do or what the error is.&lt;/P&gt;
&lt;P&gt;I cannot copy and paste and run it from a PNG file.&lt;/P&gt;
&lt;P&gt;Please read &lt;STRONG&gt;&lt;A href="https://community.cisco.com/t5/security-documents/how-to-ask-the-community-for-help/ta-p/3704356" target="_blank" rel="noopener"&gt;How to Ask the Community for Help&lt;/A&gt;&lt;/STRONG&gt;.&lt;/P&gt;</description>
      <pubDate>Sun, 02 May 2021 14:42:50 GMT</pubDate>
      <guid>https://community.cisco.com/t5/network-access-control/ise-guest-creation-using-python-script/m-p/4396717#M567061</guid>
      <dc:creator>thomas</dc:creator>
      <dc:date>2021-05-02T14:42:50Z</dc:date>
    </item>
    <item>
      <title>Re: ISE Guest creation using Python script</title>
      <link>https://community.cisco.com/t5/network-access-control/ise-guest-creation-using-python-script/m-p/4396718#M567062</link>
      <description>&lt;P&gt;HI Thomas&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am try to&amp;nbsp;&lt;SPAN&gt;&amp;nbsp;create internal&amp;nbsp;&amp;nbsp;users with my Python script. This is my code I&amp;nbsp;&amp;nbsp;created&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;#!/usr/bin/python&lt;BR /&gt;import http.client&lt;BR /&gt;import base64&lt;BR /&gt;import ssl&lt;BR /&gt;import sys&lt;BR /&gt;import os&lt;BR /&gt;argv = sys.argv[1]&lt;BR /&gt;print ("The name of the script: ", sys.argv[0])&lt;BR /&gt;print ("The argument are: ", argv)&lt;BR /&gt;#parameters&lt;/P&gt;&lt;P&gt;Id = sys.argv[4] # "B100"&lt;BR /&gt;userName = sys.argv[5] # "Robert"&lt;BR /&gt;firstName = sys.argv[6] # "Robert"&lt;BR /&gt;lastName = sys.argv[7] # "Mensah"&lt;BR /&gt;password = sys.argv[8] # "Password1"&lt;BR /&gt;emailAddress = sys.argv[9] # "rmensah@cisco.com&lt;BR /&gt;expiryDate = sys.argv[11] # “12/26/2020”&lt;BR /&gt;identityGroups = sys.argv[10] # “identityGroups”&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;# host and authentication credentials&lt;BR /&gt;host = sys.argv[1] # "192.198”.1.1&lt;BR /&gt;user = sys.argv[2] # “ers-admin”&lt;BR /&gt;password = sys.argv[3] # “admin20!”&lt;/P&gt;&lt;P&gt;conn = http.client.HTTPSConnection("{}:9060".format(host), context=ssl.SSLContext(ssl.PROTOCOL_TLS))&lt;/P&gt;&lt;P&gt;creds = str.encode(':'.join((user, password)))&lt;BR /&gt;encodedAuth = bytes.decode(base64.b64encode(creds))&lt;/P&gt;&lt;P&gt;req_body_json = """{{&lt;/P&gt;&lt;P&gt;\"InternalUser"\ : {&lt;/P&gt;&lt;P&gt;"id" : "\{}\",&lt;/P&gt;&lt;P&gt;"userName" : "\{}\",&lt;/P&gt;&lt;P&gt;"description" : "\{}\",&lt;/P&gt;&lt;P&gt;"enabled" : true,&lt;/P&gt;&lt;P&gt;"email" : "\{}\",&lt;/P&gt;&lt;P&gt;"password" : "\{}\",&lt;/P&gt;&lt;P&gt;"firstName" : "\{}\",&lt;/P&gt;&lt;P&gt;"lastName" : "\{}\",&lt;/P&gt;&lt;P&gt;"changePassword" : true,&lt;/P&gt;&lt;P&gt;"identityGroups" : "\{}\",&lt;/P&gt;&lt;P&gt;"expiryDateEnabled" : false,&lt;/P&gt;&lt;P&gt;"expiryDate" : "\{}\",&lt;/P&gt;&lt;P&gt;"enablePassword" : "enablePassword",&lt;/P&gt;&lt;P&gt;"customAttributes" : {&lt;/P&gt;&lt;P&gt;"key1" : "value1",&lt;/P&gt;&lt;P&gt;"key2" : "value3"&lt;/P&gt;&lt;P&gt;},&lt;/P&gt;&lt;P&gt;"passwordIDStore" : "Internal Users"&lt;/P&gt;&lt;P&gt;}&lt;/P&gt;&lt;P&gt;}}&lt;BR /&gt;}}""".format(Id,UserNname,firstName,lastName,emailAddress,password,identityGroups,expiryDate)&lt;BR /&gt;headers = {&lt;BR /&gt;'accept': "application/json",&lt;BR /&gt;'content-type': "application/json",&lt;BR /&gt;'authorization': " ".join(("Basic",encodedAuth)),&lt;BR /&gt;'cache-control': "no-cache",&lt;BR /&gt;}&lt;BR /&gt;conn.request("POST", "/ers/config/internaluser/", headers=headers, body=req_body_json)&lt;BR /&gt;&lt;BR /&gt;es = conn.getresponse()&lt;BR /&gt;data = res.read()&lt;/P&gt;&lt;P&gt;print("Status: {}".format(res.status))&lt;BR /&gt;print("Header:\n{}".format(res.headers))&lt;BR /&gt;print("Body:\n{}".format(data.decode("utf-8")))&lt;BR /&gt;print (req_req_json)&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I got this error while&amp;nbsp; executing the above code&lt;/P&gt;&lt;P&gt;Traceback (most recent call last):&lt;BR /&gt;File "C:\Users\ghibuser\Desktop\ISEInternalUserTest.py", line 38, in &amp;lt;module&amp;gt;&lt;BR /&gt;req_body_json = """{{&lt;BR /&gt;IndexError: Replacement index 7 out of range for positional args tuple&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Any support will be welcomed&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 03 May 2021 10:26:36 GMT</pubDate>
      <guid>https://community.cisco.com/t5/network-access-control/ise-guest-creation-using-python-script/m-p/4396718#M567062</guid>
      <dc:creator>RichardAcolatse8417</dc:creator>
      <dc:date>2021-05-03T10:26:36Z</dc:date>
    </item>
  </channel>
</rss>

