I get this error when running my python script. elastic_transport.TlsError: TLS error caused by: TlsError(TLS error caused by: SSLError([SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: CA cert does not include key usage extension (_ssl.c:1020))) I installed elastic search with docker, and i have a container for elastic search and another for kibana. Now this script is 9 months old, but I don't know what I did differently then, I have no idea why it doesn't work. I get data from groups through the Telegram API, and I plug them into elastic search, except I get the error. I copied the certification from the container, added it to Trusted Root Certification Authorities. NOTHING. I am lost and hopefully someone can help me with the specific code, I couldn't find any solution. groups_file = open('telegram_channels.txt', 'r') # enter your channel group id -100 after this digit # Set the time range to get messages from start_time = datetime.now() - timedelta(hours=24) flag = 0 groups = groups_file.readlines() def greet(): while True: days = int(input('Choose the number of days that represent the period within which data will be' ' collected (e.g. last 5 days) (Max. 14 days)\n>>>')) if days > 0 and days < 15: break return days async def get_group_messages(days): # Create a Telegram client with the specified API ID, API hash and phone number client = TelegramClient('session_name', int(api_id), api_hash) await client.connect() # Check if the user is already authorized, otherwise prompt the user to authorize the client if not await client.is_user_authorized(): await client.send_code_request(phone_number) await client.sign_in(phone_number, input('Enter the code: ')) data = [] # Get the ID of the specified group for index in range(len(groups)): group = await client.get_entity(groups[index]) date_today = datetime.now() lower_bound = date_today - timedelta(days=days) # below commented code is used for specified time range async for message in client.iter_messages(group, min_id=1): if str(message.date) < str(lower_bound): break message_reactions = message.reactions reactions = [] if message_reactions: reaction_counts = message_reactions.results for reaction_count in reaction_counts: emoji = reaction_count.reaction.emoticon count = reaction_count.count reactions.append({'emoji': emoji, 'count': count}) data_object = {"channel": group.title, "date": message.date, "text": message.text, "views": message.views, "reactions": reactions} data.append(data_object) return data def index_messages_to_elasticsearch(messages): es = Elasticsearch([{'host': es_host, 'port': es_port, 'scheme': es_scheme}], basic_auth=(es_user, es_pass)) for message in messages: es.index(index='telegram', body=message) async def main(): days = greet() messages = await get_group_messages(days) index_messages_to_elasticsearch(messages) # Run the main function asyncio.run(main()) I tried most things, but I remember that when I ran the code last year, I didn't do anyhting special, the hard part was setting up the elastic search ecosystem. Continue reading...