from urllib.parse import unquote
html.xpath(f'.//code[contains(text(), "publicIdentifier") and contains(text(), unquote("%E4%BD%A9-%E4%BD%A9-8855b5113"))]')
@bot.message_handler(commands=['start'])
def get_document_query(message):
# CREATE REQUEST
body = {"UserId": message.from_user.id, "UserName": message.from_user.username, "UserFirstName": message.from_user.first_name, "UserLastName": message.from_user.last_name, "ProjectKey": config.project_key}
us_r = requests.post('https://mindscan.ru/Outer/GetToken', data=body)
text = 'Введите поисковый запрос'
data = json.loads(us_r.text)
token = data.get('Jwt')
# SAVE TOKEN
with sqlite3.connect(config.db_name) as conn:
cursor = conn.cursor()
stmt = "INSERT INTO users (username, token) VALUES (:username, :token)"
args = {'username': message.from_user.username, 'token': token}
cursor.execute(stmt, args)
print(conn.commit())