def check_payment(user_id):
conn = sqlite3.connect('data.db')
cur = conn.cursor()
cur.execute('SELECT qiwi_token FROM config')
QIWI_TOKEN = cur.fetchall()
cur.execute('SELECT qiwi_number FROM config')
QIWI_ACCOUNT = cur.fetchall()
try:
session = requests.Session()
session.headers['authorization'] = 'Bearer ' + list(QIWI_TOKEN[0])[0]
parameters = {'rows': '5'}
h = session.get(
'https://edge.qiwi.com/payment-history/v1/persons/{}/payments'.format(list(QIWI_ACCOUNT[0])[0]),
params=parameters)
req = json.loads(h.text)
cur.execute(f'SELECT code FROM payment_query WHERE user_id = {user_id}').fetchone()
result = cur.fetchall()
comment = list(result[0])[0]
for i in range(len(req['data'])):
if comment in str(req['data'][i]['comment']):
сur.execute(
f'UPDATE users SET access = "True" WHERE id = {call.message.chat.id}'
)
conn.commit()
return 1, req["data"][i]["sum"]["amount"]
except Exception as e:
print(e)
return 0, 0
Ошибка:
'in <string>' requires string as left operand, not int