<?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 Create Internal Users with python in Network Access Control</title>
    <link>https://community.cisco.com/t5/network-access-control/create-internal-users-with-python/m-p/4407612#M567502</link>
    <description>&lt;P&gt;Hi Everyone ,&lt;/P&gt;&lt;P&gt;I am&amp;nbsp; creating internal user with python and argparse&lt;/P&gt;&lt;P&gt;This is error with my command&amp;nbsp;&lt;/P&gt;&lt;P&gt;C:\Users\guser\Desktop&amp;gt;python user1.py abt200 john.doe@gh.co.uk pa@ssWord1 John Doe&lt;BR /&gt;Traceback (most recent call last):&lt;BR /&gt;File "C:\Users\guser\Desktop\user1.py", line 24, in &amp;lt;module&amp;gt;&lt;BR /&gt;req_body_json = """ {{&lt;BR /&gt;IndexError: Replacement index 5 out of range for positional args tuple&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;this is my code :&lt;/P&gt;&lt;P&gt;#!/usr/bin/env python&lt;BR /&gt;import requests&lt;BR /&gt;import json&lt;BR /&gt;import argparse&lt;BR /&gt;import sys&lt;BR /&gt;&lt;BR /&gt;requests.packages.urllib3.disable_warnings()&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;url = "&lt;A href="https://192.169.35.16:9060/ers/config/internaluser" target="_blank"&gt;https://192.169.35.16:9060/ers/config/internaluser&lt;/A&gt;"&lt;/P&gt;&lt;P&gt;parser = argparse.ArgumentParser()&lt;/P&gt;&lt;P&gt;parser.add_argument("name", help='Enter the name')&lt;BR /&gt;parser.add_argument("email", help='Enter the email')&lt;BR /&gt;parser.add_argument("password", help='Enter the password')&lt;BR /&gt;parser.add_argument("firstname", help='Enter the first name')&lt;BR /&gt;parser.add_argument("lastname", help='Enter the last name')&lt;/P&gt;&lt;P&gt;opts = parser.parse_args()&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;req_body_json = """ {{&lt;BR /&gt;"InternalUser" : {{&lt;BR /&gt;"name" : "{}",&lt;BR /&gt;"enabled" : true,&lt;BR /&gt;"email" : "{}",&lt;BR /&gt;"password" : "{}",&lt;BR /&gt;"firstName" : "{}",&lt;BR /&gt;"lastName" : "{}",&lt;BR /&gt;"changePassword" : true,&lt;BR /&gt;"expiryDateEnabled" : true,&lt;BR /&gt;"expiryDate" : "{}",&lt;BR /&gt;"enablePassword" : "{}",&lt;BR /&gt;"customAttributes" : {{&lt;BR /&gt;}},&lt;BR /&gt;"passwordIDStore" : "Internal Users"&lt;BR /&gt;}}&lt;BR /&gt;}}&lt;BR /&gt;""".format("name","email","passorwd","firstname","lastname")&lt;/P&gt;&lt;P&gt;headers = {&lt;BR /&gt;'Content-Type': 'application/json',&lt;BR /&gt;'Accept': 'application/json',&lt;BR /&gt;'Authorization': 'Basic ZXJzYWRtaW46b0ZsUFJybmU0NTE=',&lt;BR /&gt;'Cookie': 'APPSESSIONID=A70D7085616DB14AD231971CA4A83803; Cookie_1=value; JSESSIONIDSSO=B37E2D40D9E08A8CE005198A09FC247F'&lt;BR /&gt;}&lt;/P&gt;&lt;P&gt;response = requests.request("POST", url, headers=headers, body=req_body_json, verify=False)&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;#print the namespace object&lt;BR /&gt;#print (opts)&lt;BR /&gt;print(response.text)&lt;BR /&gt;print ('The name is' + opts.name)&lt;BR /&gt;print ('The email is ' + opts.email)&lt;BR /&gt;print ('The password is' + opts.password)&lt;BR /&gt;print ('The first name is' + opts.firstname)&lt;BR /&gt;print ('The last name is ' + opts.lastname)&lt;BR /&gt;print(req_body_json)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Any Help would&amp;nbsp; appreciated&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you ,&lt;/P&gt;&lt;P&gt;Richie&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Mon, 24 May 2021 12:50:15 GMT</pubDate>
    <dc:creator>Richie20</dc:creator>
    <dc:date>2021-05-24T12:50:15Z</dc:date>
    <item>
      <title>Create Internal Users with python</title>
      <link>https://community.cisco.com/t5/network-access-control/create-internal-users-with-python/m-p/4407612#M567502</link>
      <description>&lt;P&gt;Hi Everyone ,&lt;/P&gt;&lt;P&gt;I am&amp;nbsp; creating internal user with python and argparse&lt;/P&gt;&lt;P&gt;This is error with my command&amp;nbsp;&lt;/P&gt;&lt;P&gt;C:\Users\guser\Desktop&amp;gt;python user1.py abt200 john.doe@gh.co.uk pa@ssWord1 John Doe&lt;BR /&gt;Traceback (most recent call last):&lt;BR /&gt;File "C:\Users\guser\Desktop\user1.py", line 24, in &amp;lt;module&amp;gt;&lt;BR /&gt;req_body_json = """ {{&lt;BR /&gt;IndexError: Replacement index 5 out of range for positional args tuple&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;this is my code :&lt;/P&gt;&lt;P&gt;#!/usr/bin/env python&lt;BR /&gt;import requests&lt;BR /&gt;import json&lt;BR /&gt;import argparse&lt;BR /&gt;import sys&lt;BR /&gt;&lt;BR /&gt;requests.packages.urllib3.disable_warnings()&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;url = "&lt;A href="https://192.169.35.16:9060/ers/config/internaluser" target="_blank"&gt;https://192.169.35.16:9060/ers/config/internaluser&lt;/A&gt;"&lt;/P&gt;&lt;P&gt;parser = argparse.ArgumentParser()&lt;/P&gt;&lt;P&gt;parser.add_argument("name", help='Enter the name')&lt;BR /&gt;parser.add_argument("email", help='Enter the email')&lt;BR /&gt;parser.add_argument("password", help='Enter the password')&lt;BR /&gt;parser.add_argument("firstname", help='Enter the first name')&lt;BR /&gt;parser.add_argument("lastname", help='Enter the last name')&lt;/P&gt;&lt;P&gt;opts = parser.parse_args()&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;req_body_json = """ {{&lt;BR /&gt;"InternalUser" : {{&lt;BR /&gt;"name" : "{}",&lt;BR /&gt;"enabled" : true,&lt;BR /&gt;"email" : "{}",&lt;BR /&gt;"password" : "{}",&lt;BR /&gt;"firstName" : "{}",&lt;BR /&gt;"lastName" : "{}",&lt;BR /&gt;"changePassword" : true,&lt;BR /&gt;"expiryDateEnabled" : true,&lt;BR /&gt;"expiryDate" : "{}",&lt;BR /&gt;"enablePassword" : "{}",&lt;BR /&gt;"customAttributes" : {{&lt;BR /&gt;}},&lt;BR /&gt;"passwordIDStore" : "Internal Users"&lt;BR /&gt;}}&lt;BR /&gt;}}&lt;BR /&gt;""".format("name","email","passorwd","firstname","lastname")&lt;/P&gt;&lt;P&gt;headers = {&lt;BR /&gt;'Content-Type': 'application/json',&lt;BR /&gt;'Accept': 'application/json',&lt;BR /&gt;'Authorization': 'Basic ZXJzYWRtaW46b0ZsUFJybmU0NTE=',&lt;BR /&gt;'Cookie': 'APPSESSIONID=A70D7085616DB14AD231971CA4A83803; Cookie_1=value; JSESSIONIDSSO=B37E2D40D9E08A8CE005198A09FC247F'&lt;BR /&gt;}&lt;/P&gt;&lt;P&gt;response = requests.request("POST", url, headers=headers, body=req_body_json, verify=False)&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;#print the namespace object&lt;BR /&gt;#print (opts)&lt;BR /&gt;print(response.text)&lt;BR /&gt;print ('The name is' + opts.name)&lt;BR /&gt;print ('The email is ' + opts.email)&lt;BR /&gt;print ('The password is' + opts.password)&lt;BR /&gt;print ('The first name is' + opts.firstname)&lt;BR /&gt;print ('The last name is ' + opts.lastname)&lt;BR /&gt;print(req_body_json)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Any Help would&amp;nbsp; appreciated&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you ,&lt;/P&gt;&lt;P&gt;Richie&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 24 May 2021 12:50:15 GMT</pubDate>
      <guid>https://community.cisco.com/t5/network-access-control/create-internal-users-with-python/m-p/4407612#M567502</guid>
      <dc:creator>Richie20</dc:creator>
      <dc:date>2021-05-24T12:50:15Z</dc:date>
    </item>
    <item>
      <title>Re: Create Internal Users with python</title>
      <link>https://community.cisco.com/t5/network-access-control/create-internal-users-with-python/m-p/4408243#M567537</link>
      <description>&lt;P&gt;Any suggestions are welcomed&lt;/P&gt;</description>
      <pubDate>Tue, 25 May 2021 11:55:45 GMT</pubDate>
      <guid>https://community.cisco.com/t5/network-access-control/create-internal-users-with-python/m-p/4408243#M567537</guid>
      <dc:creator>Richie20</dc:creator>
      <dc:date>2021-05-25T11:55:45Z</dc:date>
    </item>
    <item>
      <title>Re: Create Internal Users with python</title>
      <link>https://community.cisco.com/t5/network-access-control/create-internal-users-with-python/m-p/4413729#M567722</link>
      <description>&lt;P&gt;See my response to &lt;a href="https://community.cisco.com/t5/user/viewprofilepage/user-id/1192302"&gt;@Richie20&lt;/a&gt; in the post &lt;A href="https://community.cisco.com/t5/network-access-control/creating-internal-users-by-python-and-argparse/m-p/4407676" target="_self"&gt;&lt;STRONG&gt;Creating Internal users by python and argparse&lt;/STRONG&gt;&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I think &lt;a href="https://community.cisco.com/t5/user/viewprofilepage/user-id/1192302"&gt;@Richie20&lt;/a&gt; and &lt;a href="https://community.cisco.com/t5/user/viewprofilepage/user-id/1181662"&gt;@RichardAcolatse8417&lt;/a&gt; are the same person - you both ask very similar questions at nearly the same time on the same day and have identical "Any suggestions are welcomed" followup requests.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Please don't duplicate requests.&lt;/P&gt;</description>
      <pubDate>Sun, 06 Jun 2021 23:10:43 GMT</pubDate>
      <guid>https://community.cisco.com/t5/network-access-control/create-internal-users-with-python/m-p/4413729#M567722</guid>
      <dc:creator>thomas</dc:creator>
      <dc:date>2021-06-06T23:10:43Z</dc:date>
    </item>
  </channel>
</rss>

