<?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 Cisco ISE with python i in Network Access Control</title>
    <link>https://community.cisco.com/t5/network-access-control/cisco-ise-with-python-i/m-p/4397017#M567086</link>
    <description>&lt;P&gt;Hi everyone&amp;nbsp;&lt;/P&gt;&lt;P&gt;Any urgent help to fix this error on my code&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Traceback (most recent call last):&lt;BR /&gt;File "C:\Users\ghibuser\Desktop\ISEInternalUserTest.py", line 25, in &amp;lt;module&amp;gt;&lt;BR /&gt;identityGroups = sys.argv[11] # “Employee”&lt;BR /&gt;IndexError: list index out of range&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;This is my code&amp;nbsp;&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;import urllib3&lt;/P&gt;&lt;P&gt;urllib3.disable_warnings(urllib3.exceptions.InsecureRequestWarning)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&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@gh.com&lt;BR /&gt;expiryDate = sys.argv[10] # “12/26/2022”&lt;BR /&gt;identityGroups = sys.argv[11] # “Employee”&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;BR /&gt;&lt;BR /&gt;\"userName\" : "\{}\",&lt;/P&gt;&lt;P&gt;&lt;BR /&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(userName,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;/P&gt;&lt;P&gt;print(req_body_json)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Any help&amp;nbsp; is welcomed&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Mon, 03 May 2021 14:22:14 GMT</pubDate>
    <dc:creator>RichardAcolatse8417</dc:creator>
    <dc:date>2021-05-03T14:22:14Z</dc:date>
    <item>
      <title>Cisco ISE with python i</title>
      <link>https://community.cisco.com/t5/network-access-control/cisco-ise-with-python-i/m-p/4397017#M567086</link>
      <description>&lt;P&gt;Hi everyone&amp;nbsp;&lt;/P&gt;&lt;P&gt;Any urgent help to fix this error on my code&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Traceback (most recent call last):&lt;BR /&gt;File "C:\Users\ghibuser\Desktop\ISEInternalUserTest.py", line 25, in &amp;lt;module&amp;gt;&lt;BR /&gt;identityGroups = sys.argv[11] # “Employee”&lt;BR /&gt;IndexError: list index out of range&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;This is my code&amp;nbsp;&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;import urllib3&lt;/P&gt;&lt;P&gt;urllib3.disable_warnings(urllib3.exceptions.InsecureRequestWarning)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&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@gh.com&lt;BR /&gt;expiryDate = sys.argv[10] # “12/26/2022”&lt;BR /&gt;identityGroups = sys.argv[11] # “Employee”&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;BR /&gt;&lt;BR /&gt;\"userName\" : "\{}\",&lt;/P&gt;&lt;P&gt;&lt;BR /&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(userName,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;/P&gt;&lt;P&gt;print(req_body_json)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Any help&amp;nbsp; is welcomed&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 03 May 2021 14:22:14 GMT</pubDate>
      <guid>https://community.cisco.com/t5/network-access-control/cisco-ise-with-python-i/m-p/4397017#M567086</guid>
      <dc:creator>RichardAcolatse8417</dc:creator>
      <dc:date>2021-05-03T14:22:14Z</dc:date>
    </item>
    <item>
      <title>Re: Cisco ISE with python i</title>
      <link>https://community.cisco.com/t5/network-access-control/cisco-ise-with-python-i/m-p/4397027#M567088</link>
      <description>&lt;P&gt;Hey&amp;nbsp;&lt;a href="https://community.cisco.com/t5/user/viewprofilepage/user-id/1181662"&gt;@RichardAcolatse8417&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;&lt;P&gt;looks like you are not supplying enough arguments when running the script.&lt;/P&gt;&lt;P&gt;Could you share your CLI command to run the script?&lt;/P&gt;&lt;P&gt;BR&lt;BR /&gt;Rick&lt;/P&gt;</description>
      <pubDate>Mon, 03 May 2021 14:07:33 GMT</pubDate>
      <guid>https://community.cisco.com/t5/network-access-control/cisco-ise-with-python-i/m-p/4397027#M567088</guid>
      <dc:creator>rschlayer</dc:creator>
      <dc:date>2021-05-03T14:07:33Z</dc:date>
    </item>
    <item>
      <title>Re: Cisco ISE with python i</title>
      <link>https://community.cisco.com/t5/network-access-control/cisco-ise-with-python-i/m-p/4397042#M567089</link>
      <description>&lt;P&gt;This is my command line&amp;nbsp; for creating Internal user on ISE&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P&gt;python ISEInternalUserTest.py 192.198.1.1 ers-admin admin20! robert Robert Mensah Password1 rmensah@gha.com Employee 12/26/2020&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you&amp;nbsp;&lt;/P&gt;&lt;P&gt;Richard&lt;/P&gt;</description>
      <pubDate>Mon, 03 May 2021 14:23:15 GMT</pubDate>
      <guid>https://community.cisco.com/t5/network-access-control/cisco-ise-with-python-i/m-p/4397042#M567089</guid>
      <dc:creator>RichardAcolatse8417</dc:creator>
      <dc:date>2021-05-03T14:23:15Z</dc:date>
    </item>
    <item>
      <title>Re: Cisco ISE with python i</title>
      <link>https://community.cisco.com/t5/network-access-control/cisco-ise-with-python-i/m-p/4397050#M567090</link>
      <description>&lt;P&gt;Looks like you are missing the&lt;/P&gt;&lt;PRE&gt;id = sys.argv[4] # "B100"&lt;/PRE&gt;&lt;P&gt;&lt;SPAN&gt;command line argument and therefore you only have 10 arguments instead of 11 which means the code&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;PRE&gt;identityGroups = sys.argv[11] # “Employee”&lt;/PRE&gt;&lt;P&gt;will fail.&lt;/P&gt;&lt;P&gt;BR&lt;BR /&gt;Rick&lt;/P&gt;</description>
      <pubDate>Mon, 03 May 2021 14:31:35 GMT</pubDate>
      <guid>https://community.cisco.com/t5/network-access-control/cisco-ise-with-python-i/m-p/4397050#M567090</guid>
      <dc:creator>rschlayer</dc:creator>
      <dc:date>2021-05-03T14:31:35Z</dc:date>
    </item>
    <item>
      <title>Re: Cisco ISE with python i</title>
      <link>https://community.cisco.com/t5/network-access-control/cisco-ise-with-python-i/m-p/4397054#M567092</link>
      <description>&lt;P&gt;how do I solve it&amp;nbsp; &amp;nbsp;to run&amp;nbsp; the command line with Cisco&amp;nbsp; ISE&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 03 May 2021 14:38:55 GMT</pubDate>
      <guid>https://community.cisco.com/t5/network-access-control/cisco-ise-with-python-i/m-p/4397054#M567092</guid>
      <dc:creator>RichardAcolatse8417</dc:creator>
      <dc:date>2021-05-03T14:38:55Z</dc:date>
    </item>
    <item>
      <title>Re: Cisco ISE with python i</title>
      <link>https://community.cisco.com/t5/network-access-control/cisco-ise-with-python-i/m-p/4397071#M567093</link>
      <description>&lt;P&gt;I am getting this error after run this command again&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;IndexError: Replacement index 8 out of range for positional args tuple&lt;/P&gt;</description>
      <pubDate>Mon, 03 May 2021 14:49:57 GMT</pubDate>
      <guid>https://community.cisco.com/t5/network-access-control/cisco-ise-with-python-i/m-p/4397071#M567093</guid>
      <dc:creator>RichardAcolatse8417</dc:creator>
      <dc:date>2021-05-03T14:49:57Z</dc:date>
    </item>
    <item>
      <title>Re: Cisco ISE with python i</title>
      <link>https://community.cisco.com/t5/network-access-control/cisco-ise-with-python-i/m-p/4397129#M567098</link>
      <description>&lt;P&gt;Any urgent help to fix the my problem&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you&lt;/P&gt;&lt;P&gt;Richard&lt;/P&gt;</description>
      <pubDate>Mon, 03 May 2021 16:08:25 GMT</pubDate>
      <guid>https://community.cisco.com/t5/network-access-control/cisco-ise-with-python-i/m-p/4397129#M567098</guid>
      <dc:creator>RichardAcolatse8417</dc:creator>
      <dc:date>2021-05-03T16:08:25Z</dc:date>
    </item>
  </channel>
</rss>

