title: InfluxDB Unauthorized 401 - with localhost access
body: <p>When try to write the data into influxDB using influxDB client. i am getting the below error. I was able to login to the influxDB web browser using <code>http://localhost:8086</code> with the same credentials provided in the code. But facing with the unauthorized message when using python code. any help would be appreciated.</p>
  <p>Error:
  raise InfluxDBClientError(err_msg, response.status_code)
  influxdb.exceptions.InfluxDBClientError: 401: {&quot;code&quot;:&quot;unauthorized&quot;,&quot;message&quot;:&quot;Unauthorized&quot;}</p>
  <p>Code:</p>
  <pre><code>from influxdb import InfluxDBClient
  from datetime import datetime
  
  
      client = InfluxDBClient('localhost', 8086, 'username', 'password', 'bucket_name') 
      for row in df.iterrows():
          influxJson = [
                      {
                          &quot;measurement&quot;:&quot;testing123&quot;,
                          &quot;time&quot; : datetime.utcnow().isoformat() + &quot;Z&quot;,
                          &quot;tags&quot;: {
                              'ResiliencyTier':'targetResiliencyTier',
                              'lob' : 'abcdefgh'
                          },
                          &quot;fields&quot;: {
                              columns[0][0] : str(row[1][0]),
                              columns[1][0] : str(row[1][1]),
  
                          }
                      }
                  ]
          client.write_points(influxJson) 
      print(&quot;InfluxDB injection DONE&quot;)
  
  startProcess()
  </code></pre>
  <p>Thanks</p>