title: Writing to kerberosed hdfs using python | Max retries exceeded with url
body: <p>I am trying to use python to write to secure hdfs using the following lib <a href="https://hdfscli.readthedocs.io/en/latest/" rel="nofollow noreferrer">link</a></p>
  <p>Authentication part:</p>
  <pre><code>def init_kinit():
      kinit_args = ['/usr/bin/kinit', '-kt', '/tmp/xx.keytab',
                    'kerberos_principle']
      subp = Popen(kinit_args, stdin=PIPE, stdout=PIPE, stderr=PIPE)
      subp.wait()
  </code></pre>
  <p>client/upload part:</p>
  <pre><code>from hdfs.ext.kerberos import KerberosClient
  client = KerberosClient(url='http://xx.com:port', session=session,
                              mutual_auth=&quot;REQUIRED&quot;)
  client.upload(
          f'/hdfspath/file.parquet',
          f'/localpath/file.parquet')
  </code></pre>
  <p>here is the error</p>
  <pre><code>    requests.exceptions.ConnectionError: HTTPConnectionPool(host='xxx', port=xxx): 
  Max retries exceeded with url: /webhdfs/v1/user/xxx/xxx.parquet?op=LISTSTATUS (Caused by NewConnectionError('&lt;urllib3.connection.HTTPConnection object at 0x7f499c104d30&gt;: Failed to establish a new connection: [Errno 111] Connection refused'))
  </code></pre>
  <p>I tried the following <a href="https://stackoverflow.com/questions/61085876/hadoop-failed-to-connect-to-hdfshadoop-using-python">link</a> and I made sure that dfs.webhdfs.enabled is enabled</p>