I am new in Python and I am having throuble to get Json variable.
payload = ""
headers = {
'Authorization': authorization,
'cache-control': "no-cache",
'Postman-Token': "65a104eb-1210-4eeb-880b-ceed78b21364"
}
response = requests.request("GET", url, data=payload, headers=headers)
x = json.loads(response.text, object_hook=lambda d: namedtuple('X',
d.keys())(*d.values()))
for a in x:
print(a.numeroComlink)
connection = cx_Oracle.connect('xxxxx/xxxxx@XE')
cursor = connection.cursor()
sql_insert = "insert into usu_obt_cot (usu_numclk) values (:usu_numclk)"
cursor.execute(sql_insert, {"usu_numclk": int(x.numeroComlink)})
connection.commit()
cursor.close()
As you can see in the code above, I have a print on the middle of the code referencing the exact field that the error below says has no attribute.
Since now I appreciate for attention.