<?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: Cisco ISE Internal User  with python in Network Access Control</title>
    <link>https://community.cisco.com/t5/network-access-control/cisco-ise-internal-user-with-python/m-p/4398988#M567180</link>
    <description>&lt;P&gt;You error has to do with basic Python syntax and not ISE APIs. Consider using a free development environment like Atom, Sublime or VSCode to catch Python syntax issues.&lt;/P&gt;
&lt;P&gt;When pasting your code, please use &lt;FONT face="courier new,courier"&gt;Preformatted&lt;/FONT&gt; text when pasting your code in the community post so we read it.&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Screen Shot 2021-05-06 at 12.38.16 PM.png" style="width: 184px;"&gt;&lt;img src="https://community.cisco.com/t5/image/serverpage/image-id/119669i67C2698270B7440A/image-size/large?v=v2&amp;amp;px=999" role="button" title="Screen Shot 2021-05-06 at 12.38.16 PM.png" alt="Screen Shot 2021-05-06 at 12.38.16 PM.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;Python is extremely sensitive to tabs/spaces used for indentation to declare scope.&lt;/P&gt;
&lt;P&gt;And it's a lot easier for you and everyone here to catch syntax errors.&lt;/P&gt;
&lt;P&gt;The only obvious things I can see is&lt;/P&gt;
&lt;P&gt;1) you need to keep the """ on it's own line&lt;/P&gt;
&lt;PRE&gt;"""&lt;BR /&gt;S.format(name,description,firstname,lastname,identityGroups,expirydate,enablePassword)&lt;/PRE&gt;
&lt;P&gt;2) you are trying to format the undefined variable &lt;FONT face="courier new,courier"&gt;S&lt;/FONT&gt; above but the actual string you want to format is &lt;FONT face="courier new,courier"&gt;req_body_json&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Thu, 06 May 2021 19:48:44 GMT</pubDate>
    <dc:creator>thomas</dc:creator>
    <dc:date>2021-05-06T19:48:44Z</dc:date>
    <item>
      <title>Cisco ISE Internal User  with python</title>
      <link>https://community.cisco.com/t5/network-access-control/cisco-ise-internal-user-with-python/m-p/4398279#M567150</link>
      <description>&lt;P&gt;Hi Everyone&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am new to Cisco ISE&amp;nbsp; with python and&amp;nbsp; I would like to create ISE Internal User with python script&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;import requests&lt;BR /&gt;import json&lt;BR /&gt;import argparse&lt;BR /&gt;import ssl&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;url = "&lt;A href="https://192.168.10.18/ers/config/internaluser" target="_blank" rel="noopener"&gt;https://192.168.10.18/ers/config/internaluser&lt;/A&gt;"&lt;/P&gt;&lt;P&gt;#Input Parameter&lt;BR /&gt;parser = argparse.ArgumentParser()&lt;BR /&gt;subparser = parser.add_subparsers(dest='command')&lt;BR /&gt;login = subparser.add_parser('login')&lt;BR /&gt;register = subparser.add_parser('register')&lt;BR /&gt;login.add_argument('--name', type=str, required=True)&lt;BR /&gt;login.add_argument('--password', type=str, required=True)&lt;BR /&gt;register.add_argument('--firstname', type=str, required=True)&lt;BR /&gt;register.add_argument('--lastname', type=str, required=True)&lt;BR /&gt;register.add_argument('--username', type=str, required=True)&lt;BR /&gt;register.add_argument('--email', type=str, required=True)&lt;BR /&gt;register.add_argument('--password', type=str, required=True)&lt;BR /&gt;register.add_argument('--identityGroups', type=str, required=True)&lt;BR /&gt;register.add_argument('--expiryeDate', type=str, required=True)&lt;BR /&gt;register.add_argument('--enablePasword', type=str, required=True)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;args = parser.parse_args()&lt;BR /&gt;if args.command == 'login':&lt;BR /&gt;print('Logging in with username:', args.username,&lt;BR /&gt;'and password:', args.password)&lt;BR /&gt;elif args.command == 'register':&lt;BR /&gt;print('Creating username', args.username,&lt;BR /&gt;'for new member', args.firstname, args.lastname,&lt;BR /&gt;'with email:', args.email,&lt;BR /&gt;'with identityGroups:', args.identityGroups,&lt;BR /&gt;'with expiryDate:', args.identityGroups,&lt;BR /&gt;'and enablePassowrd:', args.enablePassword,&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;{&lt;BR /&gt;&lt;BR /&gt;req_body_json= """ {{&lt;/P&gt;&lt;P&gt;"InternalUser" : {&lt;/P&gt;&lt;P&gt;"id" : "{}",&lt;/P&gt;&lt;P&gt;"name" : "{}",&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" : "{}",&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;}}&lt;BR /&gt;"""S.format(name,description,firstname,lastname,identityGroups,expirydate,enablePassword)&lt;BR /&gt;headers = {&lt;BR /&gt;'Content-Type': 'application/json',&lt;BR /&gt;'Accept': 'application/json',&lt;BR /&gt;'Authorization': 'Basic cmFjb2xhdHNlOm9GbFBScm5lNDU='&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;&lt;BR /&gt;res = conn.getresponse()&lt;BR /&gt;data = res.read()&lt;/P&gt;&lt;P&gt;print("req_body_json")&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;this is my error&lt;/P&gt;&lt;P&gt;File "C:\Users\ghibuser\Desktop\ERSInternalUser.py", line 90&lt;BR /&gt;headers = {&lt;BR /&gt;^&lt;BR /&gt;SyntaxError: invalid syntax&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Any suggestions are welcome to improve this code&amp;nbsp; for Cisco ISE to&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 05 May 2021 16:52:30 GMT</pubDate>
      <guid>https://community.cisco.com/t5/network-access-control/cisco-ise-internal-user-with-python/m-p/4398279#M567150</guid>
      <dc:creator>Richie20</dc:creator>
      <dc:date>2021-05-05T16:52:30Z</dc:date>
    </item>
    <item>
      <title>Re: Cisco ISE Internal User  with python</title>
      <link>https://community.cisco.com/t5/network-access-control/cisco-ise-internal-user-with-python/m-p/4398988#M567180</link>
      <description>&lt;P&gt;You error has to do with basic Python syntax and not ISE APIs. Consider using a free development environment like Atom, Sublime or VSCode to catch Python syntax issues.&lt;/P&gt;
&lt;P&gt;When pasting your code, please use &lt;FONT face="courier new,courier"&gt;Preformatted&lt;/FONT&gt; text when pasting your code in the community post so we read it.&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Screen Shot 2021-05-06 at 12.38.16 PM.png" style="width: 184px;"&gt;&lt;img src="https://community.cisco.com/t5/image/serverpage/image-id/119669i67C2698270B7440A/image-size/large?v=v2&amp;amp;px=999" role="button" title="Screen Shot 2021-05-06 at 12.38.16 PM.png" alt="Screen Shot 2021-05-06 at 12.38.16 PM.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;Python is extremely sensitive to tabs/spaces used for indentation to declare scope.&lt;/P&gt;
&lt;P&gt;And it's a lot easier for you and everyone here to catch syntax errors.&lt;/P&gt;
&lt;P&gt;The only obvious things I can see is&lt;/P&gt;
&lt;P&gt;1) you need to keep the """ on it's own line&lt;/P&gt;
&lt;PRE&gt;"""&lt;BR /&gt;S.format(name,description,firstname,lastname,identityGroups,expirydate,enablePassword)&lt;/PRE&gt;
&lt;P&gt;2) you are trying to format the undefined variable &lt;FONT face="courier new,courier"&gt;S&lt;/FONT&gt; above but the actual string you want to format is &lt;FONT face="courier new,courier"&gt;req_body_json&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 06 May 2021 19:48:44 GMT</pubDate>
      <guid>https://community.cisco.com/t5/network-access-control/cisco-ise-internal-user-with-python/m-p/4398988#M567180</guid>
      <dc:creator>thomas</dc:creator>
      <dc:date>2021-05-06T19:48:44Z</dc:date>
    </item>
  </channel>
</rss>

