<?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 Splunk Python API - ValueError: Invalid IPv6 URL in Splunk Dev</title>
    <link>https://community.splunk.com/t5/Splunk-Dev/Splunk-Python-API-ValueError-Invalid-IPv6-URL/m-p/385478#M6434</link>
    <description>&lt;P&gt;I am trying to coonect splunk using the below python code, but I get below errors. Any idea what am I doing wrong?&lt;BR /&gt;
I have the following version of python and Splunk SDK installed. &lt;/P&gt;

&lt;P&gt;splunk-sdk 1.6.6&lt;BR /&gt;
python 3.6 (64bit)&lt;/P&gt;

&lt;P&gt;import splunklib.client as client&lt;/P&gt;

&lt;P&gt;HOST = '&lt;A href="https://ecomsplunk.mydomain.com" target="_blank"&gt;https://ecomsplunk.mydomain.com&lt;/A&gt;'&lt;BR /&gt;
PORT = '443'&lt;BR /&gt;
USERNAME = 'user'&lt;BR /&gt;
PASSWORD = 'password'&lt;BR /&gt;
try:&lt;BR /&gt;
    # Create a Service instance and log in &lt;BR /&gt;
    service = client.connect(&lt;BR /&gt;
        host=HOST,&lt;BR /&gt;
        port=PORT,&lt;BR /&gt;
        username=USERNAME,&lt;BR /&gt;
        password=PASSWORD)&lt;BR /&gt;
except Exception as url_exception:&lt;BR /&gt;
    print("Exception Unable to connect " + str(url_exception))&lt;/P&gt;

&lt;P&gt;Traceback (most recent call last):&lt;BR /&gt;
  File "C:\Users\splunk_test.py", line 17, in &lt;BR /&gt;
    password=PASSWORD)&lt;BR /&gt;
  File "C:\Users\splunklib\client.py", line 331, in connect&lt;BR /&gt;
    s.login()&lt;BR /&gt;
  File "C:\Users\site-packages\splunklib\binding.py", line 872, in login&lt;BR /&gt;
    cookie="1") # In Splunk 6.2+, passing "cookie=1" will return the "set-cookie" header&lt;BR /&gt;
  File "C:\Users\site-packages\splunklib\binding.py", line 1224, in post&lt;BR /&gt;
    return self.request(url, message)&lt;BR /&gt;
  File "C:\Users\site-packages\splunklib\binding.py", line 1241, in request&lt;BR /&gt;
    response = self.handler(url, message, **kwargs)&lt;BR /&gt;
  File "C:\Users\site-packages\splunklib\binding.py", line 1366, in request&lt;BR /&gt;
    scheme, host, port, path = _spliturl(url)&lt;BR /&gt;
  File "C:\Users\site-packages\splunklib\binding.py", line 1071, in _spliturl&lt;BR /&gt;
    parsed_url = urllib.parse.urlparse(url)&lt;BR /&gt;
  File "C:\Users\urllib\parse.py", line 368, in urlparse&lt;BR /&gt;
    splitresult = urlsplit(url, scheme, allow_fragments)&lt;BR /&gt;
  File "C:\Users\urllib\parse.py", line 441, in urlsplit&lt;BR /&gt;
    raise ValueError("Invalid IPv6 URL")&lt;BR /&gt;
ValueError: Invalid IPv6 URL&lt;BR /&gt;
Press any key to continue . . .&lt;/P&gt;</description>
    <pubDate>Tue, 29 Sep 2020 23:54:40 GMT</pubDate>
    <dc:creator>vas123</dc:creator>
    <dc:date>2020-09-29T23:54:40Z</dc:date>
    <item>
      <title>Splunk Python API - ValueError: Invalid IPv6 URL</title>
      <link>https://community.splunk.com/t5/Splunk-Dev/Splunk-Python-API-ValueError-Invalid-IPv6-URL/m-p/385478#M6434</link>
      <description>&lt;P&gt;I am trying to coonect splunk using the below python code, but I get below errors. Any idea what am I doing wrong?&lt;BR /&gt;
I have the following version of python and Splunk SDK installed. &lt;/P&gt;

&lt;P&gt;splunk-sdk 1.6.6&lt;BR /&gt;
python 3.6 (64bit)&lt;/P&gt;

&lt;P&gt;import splunklib.client as client&lt;/P&gt;

&lt;P&gt;HOST = '&lt;A href="https://ecomsplunk.mydomain.com" target="_blank"&gt;https://ecomsplunk.mydomain.com&lt;/A&gt;'&lt;BR /&gt;
PORT = '443'&lt;BR /&gt;
USERNAME = 'user'&lt;BR /&gt;
PASSWORD = 'password'&lt;BR /&gt;
try:&lt;BR /&gt;
    # Create a Service instance and log in &lt;BR /&gt;
    service = client.connect(&lt;BR /&gt;
        host=HOST,&lt;BR /&gt;
        port=PORT,&lt;BR /&gt;
        username=USERNAME,&lt;BR /&gt;
        password=PASSWORD)&lt;BR /&gt;
except Exception as url_exception:&lt;BR /&gt;
    print("Exception Unable to connect " + str(url_exception))&lt;/P&gt;

&lt;P&gt;Traceback (most recent call last):&lt;BR /&gt;
  File "C:\Users\splunk_test.py", line 17, in &lt;BR /&gt;
    password=PASSWORD)&lt;BR /&gt;
  File "C:\Users\splunklib\client.py", line 331, in connect&lt;BR /&gt;
    s.login()&lt;BR /&gt;
  File "C:\Users\site-packages\splunklib\binding.py", line 872, in login&lt;BR /&gt;
    cookie="1") # In Splunk 6.2+, passing "cookie=1" will return the "set-cookie" header&lt;BR /&gt;
  File "C:\Users\site-packages\splunklib\binding.py", line 1224, in post&lt;BR /&gt;
    return self.request(url, message)&lt;BR /&gt;
  File "C:\Users\site-packages\splunklib\binding.py", line 1241, in request&lt;BR /&gt;
    response = self.handler(url, message, **kwargs)&lt;BR /&gt;
  File "C:\Users\site-packages\splunklib\binding.py", line 1366, in request&lt;BR /&gt;
    scheme, host, port, path = _spliturl(url)&lt;BR /&gt;
  File "C:\Users\site-packages\splunklib\binding.py", line 1071, in _spliturl&lt;BR /&gt;
    parsed_url = urllib.parse.urlparse(url)&lt;BR /&gt;
  File "C:\Users\urllib\parse.py", line 368, in urlparse&lt;BR /&gt;
    splitresult = urlsplit(url, scheme, allow_fragments)&lt;BR /&gt;
  File "C:\Users\urllib\parse.py", line 441, in urlsplit&lt;BR /&gt;
    raise ValueError("Invalid IPv6 URL")&lt;BR /&gt;
ValueError: Invalid IPv6 URL&lt;BR /&gt;
Press any key to continue . . .&lt;/P&gt;</description>
      <pubDate>Tue, 29 Sep 2020 23:54:40 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Dev/Splunk-Python-API-ValueError-Invalid-IPv6-URL/m-p/385478#M6434</guid>
      <dc:creator>vas123</dc:creator>
      <dc:date>2020-09-29T23:54:40Z</dc:date>
    </item>
    <item>
      <title>Re: Splunk Python API - ValueError: Invalid IPv6 URL</title>
      <link>https://community.splunk.com/t5/Splunk-Dev/Splunk-Python-API-ValueError-Invalid-IPv6-URL/m-p/385479#M6435</link>
      <description>&lt;P&gt;I was able to get it resolve my problem by using the following code:&lt;/P&gt;

&lt;P&gt;import splunklib.client as client&lt;/P&gt;

&lt;P&gt;HOST = 'ecomsplunk.mydomain.com'&lt;BR /&gt;
PORT = '8089'&lt;BR /&gt;
USERNAME = 'user'&lt;BR /&gt;
PASSWORD = 'password'&lt;BR /&gt;
try:&lt;/P&gt;

&lt;H1&gt;Create a Service instance and log in&lt;/H1&gt;

&lt;P&gt;service = client.connect(&lt;BR /&gt;
host=HOST,&lt;BR /&gt;
port=PORT,&lt;BR /&gt;
username=USERNAME,&lt;BR /&gt;
password=PASSWORD,&lt;BR /&gt;
scheme='https')&lt;BR /&gt;
except Exception as url_exception:&lt;BR /&gt;
print("Exception Unable to connect " + str(url_exception))&lt;/P&gt;</description>
      <pubDate>Tue, 29 Sep 2020 23:54:51 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Dev/Splunk-Python-API-ValueError-Invalid-IPv6-URL/m-p/385479#M6435</guid>
      <dc:creator>vas123</dc:creator>
      <dc:date>2020-09-29T23:54:51Z</dc:date>
    </item>
  </channel>
</rss>

