title: Problems while trying to insert API DATA in SQL LITE DATABASE
body: <p>everyone! So basically I have this problem. I'm trying to make a request to a <code>zipcode API</code> on Brazil, but the data is showed on the <code>JSON</code> format. What I have to do, it's to take this information from the <code>API</code> and put it on a <code>SQLlite database</code>. But, somehow I don't know how to do it. I tried to use this code:</p>
  <pre><code>import requests
  import sqlite3
  import json
  print('Identifying the ZIP CODE')
  CEPC = input('Please type the zipcode:')
  Requisicao = requests.get('https://viacep.com.br/ws/%7B%7D/json/%27.format(CEPC))
  print(Requisicao.json())
  #Database
  con = sqlite3.connect('CEPS.db')
  cur = con.cursor()
  cur.execute('DROP TABLE IF EXISTS Requisicao')
  cur.execute(&quot;CREATE TABLE Requisicao (cep int(8), data json)&quot;)
  for Requisicao1 in Requisicao:
  cur.execute(&quot;insert into Requisicao values (8, 5)&quot;,
            [Requisicao1['cep'], json.dumps(Requisicao1)])
  cur.commit()
  cur.close()
  </code></pre>
  <p>It's all working when I try to make the request to the API, but when I try to insert the data on the database I just can't. When it come to this code part:</p>
  <pre><code>for or Requisicao1 in Requisicao:
  cur.execute(&quot;insert into Requisicao values (8, 5)&quot;,
        [Requisicao1['cep'], json.dumps(Requisicao1)])
  
  
  
  It gives me the error: TypeError: byte indices must be integers or slices, not str.
  </code></pre>
  <p>Examples of zipcodes are: <code>09931080, 05565000</code>.</p>
  <p><strong>The outpout to the zipcode example is:</strong></p>
  <pre><code>{
    &quot;cep&quot;: &quot;05565-000&quot;,
    &quot;logradouro&quot;: &quot;Avenida General Asdrúbal da Cunha&quot;,
    &quot;complemento&quot;: &quot;&quot;,
    &quot;bairro&quot;: &quot;Jardim Arpoador&quot;,
    &quot;localidade&quot;: &quot;São Paulo&quot;,
    &quot;uf&quot;: &quot;SP&quot;,
    &quot;ibge&quot;: &quot;3550308&quot;,
    &quot;gia&quot;: &quot;1004&quot;,
    &quot;ddd&quot;: &quot;11&quot;,
    &quot;siafi&quot;: &quot;7107&quot;
  }
  </code></pre>
  <p>This is the output when I try to get the request.</p>