<?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 Internal User Creation with python script in Network Access Control</title>
    <link>https://community.cisco.com/t5/network-access-control/internal-user-creation-with-python-script/m-p/4397051#M567091</link>
    <description>&lt;P&gt;Hi Everyone ,&lt;/P&gt;&lt;P&gt;I am creating python script for Internal user for Cisco ISE&amp;nbsp; .&amp;nbsp; I want to&amp;nbsp; know if the code format is okay to run the code&amp;nbsp;&lt;/P&gt;&lt;P&gt;.&amp;nbsp; Any help of how to run with command line&amp;nbsp; or python interpreter&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;DIV&gt;&lt;P&gt;#!/usr/bin/python&lt;BR /&gt;import requests&lt;BR /&gt;import json&lt;BR /&gt;import urllib3&lt;BR /&gt;urllib3.disable_warnings(urllib3.exceptions.InsecureRequestWarning)&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;url = "xxxxxxxxxxxxxxxxx/ers/config/internaluser"&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;payload={}&lt;BR /&gt;headers = {&lt;BR /&gt;'Content-Type': 'application/json',&lt;BR /&gt;'Accept': 'application/json',&lt;BR /&gt;'Cookie': 'APPSESSIONID=B084095F5B5131E3901583FBE99C2129'&lt;BR /&gt;}&lt;/P&gt;&lt;P&gt;resources =[]&lt;/P&gt;&lt;P&gt;while (url) :&lt;BR /&gt;# add resources to list&lt;BR /&gt;response = requests.request("POST", url, headers=headers, data=payload, verify=False)&lt;BR /&gt;resources += response.json()["SearchResult"]["resources"]&lt;BR /&gt;try :&lt;BR /&gt;url = response.json()["SearchResult"]["nextPage"]["href"]&lt;BR /&gt;except Exception as e :&lt;BR /&gt;url = None&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;\"Name\" : "\{}\",&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;BR /&gt;}}&lt;BR /&gt;}}""".format(id,userName,firstName,lastName,emailAddress,password,identityGroups,expiryDate)&lt;/P&gt;&lt;P&gt;print(req_body_json)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Can any one help me out with this error . i need help urgently&amp;nbsp;&lt;/P&gt;&lt;P&gt;Traceback (most recent call last):&lt;BR /&gt;File "C:/Users/ghibuser/Desktop/internal_user.py", line 22, in &amp;lt;module&amp;gt;&lt;BR /&gt;response = requests.request("POST", url, headers=headers, data=payload, verify=False)&lt;BR /&gt;File "C:\Users\ghibuser\AppData\Local\Programs\Python\Python39\lib\site-packages\requests\api.py", line 61, in request&lt;BR /&gt;return session.request(method=method, url=url, **kwargs)&lt;BR /&gt;File "C:\Users\ghibuser\AppData\Local\Programs\Python\Python39\lib\site-packages\requests\sessions.py", line 528, in request&lt;BR /&gt;prep = self.prepare_request(req)&lt;BR /&gt;File "C:\Users\ghibuser\AppData\Local\Programs\Python\Python39\lib\site-packages\requests\sessions.py", line 456, in prepare_request&lt;BR /&gt;p.prepare(&lt;BR /&gt;File "C:\Users\ghibuser\AppData\Local\Programs\Python\Python39\lib\site-packages\requests\models.py", line 316, in prepare&lt;BR /&gt;self.prepare_url(url, params)&lt;BR /&gt;File "C:\Users\ghibuser\AppData\Local\Programs\Python\Python39\lib\site-packages\requests\models.py", line 390, in prepare_url&lt;BR /&gt;raise MissingSchema(error)&lt;BR /&gt;requests.exceptions.MissingSchema: Invalid URL 'xxxxxxxxxxxxxxxxx/ers/config/internal&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;/DIV&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Mon, 03 May 2021 15:48:31 GMT</pubDate>
    <dc:creator>RichardAcolatse8417</dc:creator>
    <dc:date>2021-05-03T15:48:31Z</dc:date>
    <item>
      <title>Internal User Creation with python script</title>
      <link>https://community.cisco.com/t5/network-access-control/internal-user-creation-with-python-script/m-p/4397051#M567091</link>
      <description>&lt;P&gt;Hi Everyone ,&lt;/P&gt;&lt;P&gt;I am creating python script for Internal user for Cisco ISE&amp;nbsp; .&amp;nbsp; I want to&amp;nbsp; know if the code format is okay to run the code&amp;nbsp;&lt;/P&gt;&lt;P&gt;.&amp;nbsp; Any help of how to run with command line&amp;nbsp; or python interpreter&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;DIV&gt;&lt;P&gt;#!/usr/bin/python&lt;BR /&gt;import requests&lt;BR /&gt;import json&lt;BR /&gt;import urllib3&lt;BR /&gt;urllib3.disable_warnings(urllib3.exceptions.InsecureRequestWarning)&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;url = "xxxxxxxxxxxxxxxxx/ers/config/internaluser"&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;payload={}&lt;BR /&gt;headers = {&lt;BR /&gt;'Content-Type': 'application/json',&lt;BR /&gt;'Accept': 'application/json',&lt;BR /&gt;'Cookie': 'APPSESSIONID=B084095F5B5131E3901583FBE99C2129'&lt;BR /&gt;}&lt;/P&gt;&lt;P&gt;resources =[]&lt;/P&gt;&lt;P&gt;while (url) :&lt;BR /&gt;# add resources to list&lt;BR /&gt;response = requests.request("POST", url, headers=headers, data=payload, verify=False)&lt;BR /&gt;resources += response.json()["SearchResult"]["resources"]&lt;BR /&gt;try :&lt;BR /&gt;url = response.json()["SearchResult"]["nextPage"]["href"]&lt;BR /&gt;except Exception as e :&lt;BR /&gt;url = None&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;\"Name\" : "\{}\",&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;BR /&gt;}}&lt;BR /&gt;}}""".format(id,userName,firstName,lastName,emailAddress,password,identityGroups,expiryDate)&lt;/P&gt;&lt;P&gt;print(req_body_json)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Can any one help me out with this error . i need help urgently&amp;nbsp;&lt;/P&gt;&lt;P&gt;Traceback (most recent call last):&lt;BR /&gt;File "C:/Users/ghibuser/Desktop/internal_user.py", line 22, in &amp;lt;module&amp;gt;&lt;BR /&gt;response = requests.request("POST", url, headers=headers, data=payload, verify=False)&lt;BR /&gt;File "C:\Users\ghibuser\AppData\Local\Programs\Python\Python39\lib\site-packages\requests\api.py", line 61, in request&lt;BR /&gt;return session.request(method=method, url=url, **kwargs)&lt;BR /&gt;File "C:\Users\ghibuser\AppData\Local\Programs\Python\Python39\lib\site-packages\requests\sessions.py", line 528, in request&lt;BR /&gt;prep = self.prepare_request(req)&lt;BR /&gt;File "C:\Users\ghibuser\AppData\Local\Programs\Python\Python39\lib\site-packages\requests\sessions.py", line 456, in prepare_request&lt;BR /&gt;p.prepare(&lt;BR /&gt;File "C:\Users\ghibuser\AppData\Local\Programs\Python\Python39\lib\site-packages\requests\models.py", line 316, in prepare&lt;BR /&gt;self.prepare_url(url, params)&lt;BR /&gt;File "C:\Users\ghibuser\AppData\Local\Programs\Python\Python39\lib\site-packages\requests\models.py", line 390, in prepare_url&lt;BR /&gt;raise MissingSchema(error)&lt;BR /&gt;requests.exceptions.MissingSchema: Invalid URL 'xxxxxxxxxxxxxxxxx/ers/config/internal&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;/DIV&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 03 May 2021 15:48:31 GMT</pubDate>
      <guid>https://community.cisco.com/t5/network-access-control/internal-user-creation-with-python-script/m-p/4397051#M567091</guid>
      <dc:creator>RichardAcolatse8417</dc:creator>
      <dc:date>2021-05-03T15:48:31Z</dc:date>
    </item>
    <item>
      <title>Re: Internal User Creation with python script</title>
      <link>https://community.cisco.com/t5/network-access-control/internal-user-creation-with-python-script/m-p/4397085#M567095</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You will have to consult python documentation for code formatting.&amp;nbsp; Maybe someone in the community with python experience will be able to comment.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Regards,&lt;/P&gt;
&lt;P&gt;Tim&lt;/P&gt;</description>
      <pubDate>Mon, 03 May 2021 15:02:50 GMT</pubDate>
      <guid>https://community.cisco.com/t5/network-access-control/internal-user-creation-with-python-script/m-p/4397085#M567095</guid>
      <dc:creator>Timothy Abbott</dc:creator>
      <dc:date>2021-05-03T15:02:50Z</dc:date>
    </item>
    <item>
      <title>Re: Internal User Creation with python script</title>
      <link>https://community.cisco.com/t5/network-access-control/internal-user-creation-with-python-script/m-p/4397128#M567097</link>
      <description>&lt;P&gt;Thank you for your assistance&amp;nbsp;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 03 May 2021 16:06:17 GMT</pubDate>
      <guid>https://community.cisco.com/t5/network-access-control/internal-user-creation-with-python-script/m-p/4397128#M567097</guid>
      <dc:creator>RichardAcolatse8417</dc:creator>
      <dc:date>2021-05-03T16:06:17Z</dc:date>
    </item>
  </channel>
</rss>

